mirror of
https://git.lolcat.ca/lolcat/4get.git
synced 2024-11-14 03:49:48 +01:00
Merge pull request 'fix treatment of config values with default of null and add php sodium' (#13) from docker_fix_gen_config into master
Reviewed-on: https://git.lolcat.ca/lolcat/4get/pulls/13
This commit is contained in:
commit
96f4fc927a
|
@ -2,7 +2,7 @@ FROM alpine:latest
|
||||||
WORKDIR /var/www/html/4get
|
WORKDIR /var/www/html/4get
|
||||||
|
|
||||||
RUN apk update && apk upgrade
|
RUN apk update && apk upgrade
|
||||||
RUN apk add php apache2-ssl php83-fileinfo php83-openssl php83-iconv php83-common php83-dom php83-curl curl php83-pecl-apcu php83-apache2 imagemagick php83-pecl-imagick php-mbstring imagemagick-webp imagemagick-jpeg
|
RUN apk add php apache2-ssl php83-fileinfo php83-openssl php83-iconv php83-common php83-dom php83-sodium php83-curl curl php83-pecl-apcu php83-apache2 imagemagick php83-pecl-imagick php-mbstring imagemagick-webp imagemagick-jpeg
|
||||||
|
|
||||||
COPY ./docker/apache/ /etc/apache2/
|
COPY ./docker/apache/ /etc/apache2/
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
|
@ -9,7 +9,7 @@ FOURGET_PROTO="${FOURGET_PROTO#\"}"
|
||||||
FOURGET_PROTO=`echo $FOURGET_PROTO | awk '{print tolower($0)}'`
|
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"
|
echo "Using https configuration"
|
||||||
cp /etc/apache2/https.conf /etc/apache2/httpd.conf
|
cp /etc/apache2/https.conf /etc/apache2/httpd.conf
|
||||||
else
|
else
|
||||||
|
|
|
@ -61,16 +61,18 @@ $output = "<?php\n // This file was generated by docker/gen_config.php\n";
|
||||||
$output = $output . "class config {\n";
|
$output = $output . "class config {\n";
|
||||||
foreach(($merged_config) as $key => $val){
|
foreach(($merged_config) as $key => $val){
|
||||||
if(!in_array($key, $special_keys)) {
|
if(!in_array($key, $special_keys)) {
|
||||||
|
$stored_value = $val;
|
||||||
// conversion between arrays and comma separated env value.
|
// 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,
|
// 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
|
// then split on comma if string (and not numeric, boolean, null, etc)
|
||||||
if(gettype($from_config[$key]) != gettype($val) && !is_numeric($val)) {
|
//
|
||||||
$data = gettype($val) === "string" ? explode(",", $val) : $val;
|
// except in the case where the inital value in default config is null. Assuming null
|
||||||
$output = $output . "\tconst " . $key . " = " . type_to_string($data) . ";\n";
|
// in default config will be never be assigned an array
|
||||||
} else {
|
|
||||||
$output = $output . "\tconst " . $key . " = " . type_to_string($val) . ";\n";
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue