httpserver-conf.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. -- httpserver-conf.lua
  2. -- Part of nodemcu-httpserver, contains static configuration for httpserver.
  3. -- Edit your server's configuration below.
  4. -- Author: Sam Dieck
  5. local conf = {}
  6. -- General server configuration.
  7. conf.general = {}
  8. -- TCP port in which to listen for incoming HTTP requests.
  9. conf.general.port = 80
  10. -- WiFi configuration
  11. conf.wifi = {}
  12. -- Can be wifi.STATION, wifi.SOFTAP, or wifi.STATIONAP
  13. conf.wifi.mode = wifi.STATION
  14. -- Theses apply only when configured as Access Point (wifi.SOFTAP or wifi.STATIONAP)
  15. if (conf.wifi.mode == wifi.SOFTAP) or (conf.wifi.mode == wifi.STATIONAP) then
  16. conf.wifi.accessPoint = {}
  17. conf.wifi.accessPoint.config = {}
  18. conf.wifi.accessPoint.config.ssid = "ESP-"..node.chipid() -- Name of the WiFi network to create.
  19. conf.wifi.accessPoint.config.pwd = "ESP-"..node.chipid() -- WiFi password for joining - at least 8 characters
  20. conf.wifi.accessPoint.net = {}
  21. conf.wifi.accessPoint.net.ip = "192.168.111.1"
  22. conf.wifi.accessPoint.net.netmask="255.255.255.0"
  23. conf.wifi.accessPoint.net.gateway="192.168.111.1"
  24. end
  25. -- These apply only when connecting to a router as a client
  26. if (conf.wifi.mode == wifi.STATION) or (conf.wifi.mode == wifi.STATIONAP) then
  27. conf.wifi.station = {}
  28. conf.wifi.station.ssid = "Internet" -- Name of the WiFi network you want to join
  29. conf.wifi.station.pwd = "" -- Password for the WiFi network
  30. end
  31. -- mDNS, applies if you compiled the mdns module in your firmware.
  32. conf.mdns = {}
  33. conf.mdns.hostname = 'nodemcu' -- You will be able to access your server at "http://nodemcu.local."
  34. conf.mdns.location = 'Earth'
  35. conf.mdns.description = 'A tiny HTTP server'
  36. -- Basic HTTP Authentication.
  37. conf.auth = {}
  38. -- Set to true if you want to enable.
  39. conf.auth.enabled = false
  40. -- Displayed in the login dialog users see before authenticating.
  41. conf.auth.realm = "nodemcu"
  42. -- Add users and passwords to this table. Do not leave this unchanged if you enable authentication!
  43. conf.auth.users = {user1 = "password1", user2 = "password2", user3 = "password3"}
  44. return conf