|
@@ -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,
|
|
|
|
|
- // 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;
|
|
continue;
|
|
|
}
|
|
}
|