diff --git a/doc/code_snippets/snippets/config/instances.enabled/application_role_http_api/http-api.lua b/doc/code_snippets/snippets/config/instances.enabled/application_role_http_api/http-api.lua index 4d2cda6c3..b5bb98096 100644 --- a/doc/code_snippets/snippets/config/instances.enabled/application_role_http_api/http-api.lua +++ b/doc/code_snippets/snippets/config/instances.enabled/application_role_http_api/http-api.lua @@ -37,7 +37,10 @@ local function apply(cfg) if httpd then httpd:stop() end - httpd = require('http.server').new(cfg.host, cfg.port) + local cfg_with_defaults = listen_address_schema:apply_default(cfg) + local host = listen_address_schema:get(cfg_with_defaults, 'host') + local port = listen_address_schema:get(cfg_with_defaults, 'port') + httpd = require('http.server').new(host, port) local response_headers = { ['content-type'] = 'application/json' } httpd:route({ path = '/band/:id', method = 'GET' }, function(req) local id = req:stash('id')