try new env vars

This commit is contained in:
luckysideburn
2024-12-31 10:11:25 +00:00
parent e0c1027ee2
commit 2a4318528b
6 changed files with 27 additions and 19 deletions

View File

@@ -38,10 +38,10 @@ spec:
containers:
- env:
{{- if .Values.ingress.enabled }}
- name: ENDPOINT
- name: APPLICATION_URL
value: {{ required ".Values.ingress.hostName is required if Ingress is enabled" .Values.ingress.hostName }}
{{- else }}
- name: ENDPOINT
- name: APPLICATION_URL
value: {{ required ".Values.route_host is required if Ingress is disabled" .Values.route_host }}
{{- end }}
- name: NAMESPACE

View File

@@ -762,7 +762,7 @@ k8s_jobs:
<div class="container text-center" style="margin-top: 20%;">
<div>
<img style="scale: 60%" src="images/kubeinvaders_spaceship2.png" id="spaceShip">
<p class="text-muted credit" style="color:#fff;">version: v1.9.7</p>
<p class="text-muted credit" style="color:#fff;">version: 2024-12-31 10:04:33</p>
</div>
</div>
</div>

View File

@@ -16,6 +16,10 @@
/* KubeInvaders Global Variables */
function checkURLProtocol(url) {
return url.startsWith("http://") || url.startsWith("https://");
}
function getCodeName() {
const prefixes = ['astro', 'cosmo', 'space', 'star', 'nova', 'nebula', 'galaxy', 'super', 'hyper', 'quantum'];
const suffixes = ['nova', 'tron', 'wave', 'core', 'pulse', 'jump', 'drive', 'ship', 'gate', 'hole'];
@@ -39,8 +43,8 @@ var spaceshipHeight = 60;
var spaceshipWidth = 60;
var spaceshipX = (canvas.width-spaceshipWidth)/2;
var spaceshipY = (canvas.height-spaceshipHeight)/2;
var clu_endpoint = "endpoint_placeholder";
var clu_insecure = insecure_endpoint_placeholder;
var clu_endpoint = "application_url_placeholder";
var clu_insecure = disable_tls_placeholder;
var demo_mode = demo_mode_placeholder;
var k8s_url = "";
var chaos_report_post_data = "";
@@ -50,12 +54,16 @@ var selected_env_vars = "selected_env_vars_placeholder";
var maxAliensPerRow = 20;
var startYforHelp = 700;
if (clu_insecure) {
if (clu_insecure && !checkURLProtocol(clu_endpoint)) {
k8s_url = "http://" + clu_endpoint;
}
else {
else if (!clu_insecure && !checkURLProtocol(clu_endpoint)) {
k8s_url = "https://" + clu_endpoint;
}
else {
k8s_url = clu_endpoint;
}
console.log("[K-INV STARTUP] k8s_url is " + k8s_url);
console.log("[K-INV STARTUP] platformengineering.it demo_mode is " + String(demo_mode));

View File

@@ -5,12 +5,12 @@ server {
index index.html;
access_log off;
set_by_lua_block $endpoint {
return os.getenv("ENDPOINT")
set_by_lua_block $application_url {
return os.getenv("APPLICATION_URL")
}
set_by_lua_block $insecure_endpoint {
local env_var = os.getenv("INSECURE_ENDPOINT")
set_by_lua_block $disable_tls {
local env_var = os.getenv("DISABLE_TLS")
if env_var then
return env_var
else
@@ -28,7 +28,7 @@ server {
}
set_by_lua_block $selected_env_vars {
local selected_env_vars = {"KUBERNETES_SERVICE_HOST", "KUBERNETES_SERVICE_PORT_HTTPS", "NAMESPACE", "INSECURE_ENDPOINT"}
local selected_env_vars = {"KUBERNETES_SERVICE_HOST", "KUBERNETES_SERVICE_PORT_HTTPS", "NAMESPACE", "DISABLE_TLS", "APPLICATION_URL"}
local result = {}
@@ -57,8 +57,8 @@ server {
etag off;
sub_filter_types "*";
sub_filter demo_mode_placeholder $demo_mode;
sub_filter endpoint_placeholder $endpoint;
sub_filter insecure_endpoint_placeholder $insecure_endpoint;
sub_filter application_url_placeholder $application_url;
sub_filter disable_tls_placeholder $disable_tls;
sub_filter selected_env_vars_placeholder $selected_env_vars;
}
@@ -104,10 +104,10 @@ server {
ngx.header['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS'
ngx.header['Access-Control-Allow-Headers'] = 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'
ngx.header['Access-Control-Expose-Headers'] = 'Content-Length,Content-Range';
if os.getenv("ENDPOINT") == nil then
ngx.say("Error! ENDPOINT is nil!")
if os.getenv("APPLICATION_URL") == nil then
ngx.say("Error! APPLICATION_URL is nil!")
else
ngx.say(os.getenv("ENDPOINT"))
ngx.say(os.getenv("APPLICATION_URL"))
end
}
}

View File

@@ -4,12 +4,12 @@ pid /var/run/nginx.pid;
env REDIS_HOST;
env TOKEN;
env K8S_TOKEN;
env ENDPOINT;
env NAMESPACE;
env KUBERNETES_SERVICE_HOST;
env KUBERNETES_SERVICE_PORT_HTTPS;
env INSECURE_ENDPOINT;
env PLATFORM_ENGINEERING_DEMO_MODE;
env APPLICATION_URL;
env DISABLE_TLS;
events {
worker_connections 1024;