diff options
author | lolcat <will@lolcat.ca> | 2024-04-27 14:26:14 -0400 |
---|---|---|
committer | lolcat <will@lolcat.ca> | 2024-04-27 14:26:14 -0400 |
commit | bad8d7ad5062a7e346b6f2774159b8381420cdb7 (patch) | |
tree | 317af43265b67ef67660aa2f084d26cb8239ff7c /docker | |
parent | f2eb164d40340cf221cb7ad457ab35492da4d308 (diff) | |
parent | 96f4fc927abfb5dc9eb7387929be757bf6787a80 (diff) |
Merge branch 'master' of https://git.lolcat.ca/lolcat/4get
Diffstat (limited to 'docker')
-rwxr-xr-x | docker/docker-entrypoint.sh | 2 | ||||
-rw-r--r-- | docker/gen_config.php | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index bdb706a..66d4067 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -9,7 +9,7 @@ FOURGET_PROTO="${FOURGET_PROTO#\"}" FOURGET_PROTO=`echo $FOURGET_PROTO | awk '{print tolower($0)}'` -if [ "$FOURGET_PROTO" = "https" ] || [ -f /etc/4get/certs/fullchain.pem ] || [ -f /etc/4get/certs/privkey.pem ]; then +if [ "$FOURGET_PROTO" = "https" ]; then echo "Using https configuration" cp /etc/apache2/https.conf /etc/apache2/httpd.conf else diff --git a/docker/gen_config.php b/docker/gen_config.php index cc43916..ceea117 100644 --- a/docker/gen_config.php +++ b/docker/gen_config.php @@ -61,16 +61,18 @@ $output = "<?php\n // This file was generated by docker/gen_config.php\n"; $output = $output . "class config {\n"; foreach(($merged_config) as $key => $val){ if(!in_array($key, $special_keys)) { - + $stored_value = $val; // conversion between arrays and comma separated env value. - // If original type of field is array and there is a type mismatch such as when a comma separted string is passed, - // then split on comma if string and not numeric - if(gettype($from_config[$key]) != gettype($val) && !is_numeric($val)) { - $data = gettype($val) === "string" ? explode(",", $val) : $val; - $output = $output . "\tconst " . $key . " = " . type_to_string($data) . ";\n"; - } else { - $output = $output . "\tconst " . $key . " = " . type_to_string($val) . ";\n"; - } + // Handle case when original type of field is array and there is a type mismatch when a comma separted string is passed, + // then split on comma if string (and not numeric, boolean, null, etc) + // + // except in the case where the inital value in default config is null. Assuming null + // in default config will be never be assigned an array + + if(gettype($from_config[$key]) != gettype($val) && !is_numeric($val) && !is_null($from_config[$key])) { + $stored_value = explode(",", $val); + } + $output = $output . "\tconst " . $key . " = " . type_to_string($stored_value) . ";\n"; continue; } |