Kong startup error when setting a numeric string as env var
zanitete opened this issue · 2 comments
zanitete commented
For example, if I try to override the value of x_session_memcache_port by setting the env var KONG_X_SESSION_MEMCACHE_PORT=8778
Kong init fails with the following error:
2021/03/09 15:46:17 [debug] 1#0: [lua] globalpatches.lua:10: installing the globalpatches
2021/03/09 15:46:17 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:440: x_session_memcache_port is not a string: '8778'
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/kong/init.lua:440: in function 'init'
init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:440: x_session_memcache_port is not a string: '8778'
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/kong/init.lua:440: in function 'init'
init_by_lua:3: in main chunk
zanitete commented
I managed to make it work by setting the env var value as follow (note the single quotes):
KONG_X_SESSION_MEMCACHE_PORT="'8778'"
cristichiru commented
Thanks for uncovering this quirk. I have tested some alternatives, like quoting the template but will fail because of the default values, that are quoted already. Cannot set numeric values in the default because the template engine will complain.
I have added your finding in the README.