File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
1313## Fixed
1414
15+ - Do not recreate server if it's address and port were not changed (#219 ).
16+
1517## [ 1.8.0] - 2025-07-07
1618
1719The release introduces a new log level configuration option in ` httpd ` role
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ local function apply_http(name, node)
121121 httpd = httpd ,
122122 routes = {},
123123 }
124- elseif servers [name ].host ~= host or servers [name ].port ~= port then
124+ elseif servers [name ].httpd . host ~= host or servers [name ]. httpd .port ~= port then
125125 servers [name ].httpd :stop ()
126126 servers [name ].httpd = http_server .new (host , port , parse_params (node ))
127127 servers [name ].httpd :start ()
Original file line number Diff line number Diff line change @@ -172,6 +172,22 @@ g.test_change_server_addr_on_the_run = function(cg)
172172 t .assert_equals (resp .body , ' pong' )
173173end
174174
175+ g .test_keep_existing_server_routes_on_config_reload = function (cg )
176+ local resp = http_client :get (' http://0.0.0.0:13001/ping_once' )
177+ t .assert_equals (resp .status , 200 , ' response not 200' )
178+ t .assert_equals (resp .body , ' pong once' )
179+
180+ local cfg = table .deepcopy (config )
181+ cfg .credentials .users .testguest = { roles = {' super' } }
182+ treegen .write_file (cg .server .chdir , ' config.yaml' , yaml .encode (cfg ))
183+ local _ , err = cg .server :eval (" require('config'):reload()" )
184+ t .assert_not (err )
185+
186+ resp = http_client :get (' http://0.0.0.0:13001/ping_once' )
187+ t .assert_equals (resp .status , 200 , ' response not 200' )
188+ t .assert_equals (resp .body , ' pong once' )
189+ end
190+
175191g .test_log_requests = function (cg )
176192 t .skip_if (cg .params .use_tls )
177193
Original file line number Diff line number Diff line change 11local M = {dependencies = { ' roles.httpd' }}
22
33local servers = {}
4+ local applied = {}
45
56M .validate = function () end
67
@@ -14,6 +15,15 @@ M.apply = function(conf)
1415 }, function (tx )
1516 return tx :render ({text = ' pong' })
1617 end )
18+
19+ if applied [server .id ] == nil then
20+ servers [server .id ]:route ({
21+ path = ' /ping_once' ,
22+ }, function (tx )
23+ return tx :render ({text = ' pong once' })
24+ end )
25+ applied [server .id ] = {}
26+ end
1727 end
1828 end
1929end
You can’t perform that action at this time.
0 commit comments