Skip to content

Commit

Permalink
change lua init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandredevely committed Apr 25, 2024
1 parent 66f5e9a commit d19a088
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions etc/nginx/sites-enabled/default
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ types {
font/opentype otf;
}


init_by_lua_block {
my_speedtest = os.getenv("SPEEDTEST_FQDN")
my_pyos = os.getenv("PYOS_FQDN")
my_console = os.getenv("CONSOLE_FQDN")
my_website = os.getenv("WEBSITE_FQDN")
}


server {

# replace the default resolver ip addr
Expand All @@ -124,11 +133,31 @@ server {
set $spawner_service_tcp_port 29786;
set $signalling_service_tcp_port 29787;

# set $my_speedtest '';
# set $my_pyos '';
# set $my_console '';
# set $my_website '';

# use env vars
set_by_lua_block $my_speedtest { return my_speedtest }
set_by_lua_block $my_pyos { return my_pyos }
set_by_lua_block $my_console { return my_console }
set_by_lua_block $my_website { return my_website }

#content_by_lua_block {
# ngx.say('Hello,world!')
# ngx.var.my_speedtest = os.getenv("SPEEDTEST_FQDN")
# ngx.var.my_pyos = os.getenv("PYOS_FQDN")
# ngx.var.my_console = os.getenv("CONSOLE_FQDN")
# ngx.var.my_website = os.getenv("WEBSITE_FQDN")
#}


# use env vars
set $my_speedtest 'return os.getenv("SPEEDTEST_FQDN")';
set $my_pyos 'return os.getenv("PYOS_FQDN")';
set $my_console 'return os.getenv("CONSOLE_FQDN")';
set $my_website 'return os.getenv("WEBSITE_FQDN")';
set_by_lua_block $my_speedtest { return os.getenv("SPEEDTEST_FQDN")' }
set_by_lua_block $my_pyos { return os.getenv("PYOS_FQDN")' }
set_by_lua_block $my_console { return os.getenv("CONSOLE_FQDN")' }
set_by_lua_block $my_website { return os.getenv("WEBSITE_FQDN")' }

#add header
add_header X-Frame-Options "SAMEORIGIN";
Expand Down

0 comments on commit d19a088

Please sign in to comment.