Merge pull request 'fix numeric values being set as string' (#40) from feature/fix_numeric into master
Reviewed-on: #40
This commit is contained in:
commit
edc917f5ee
|
@ -177,6 +177,8 @@ any environment variables prefixed with `FOURGET_` will be added to the generate
|
||||||
|
|
||||||
the entrypoint will automatically set the `CAPTCHA_DATASET` value for you based on directory names and number of files in each
|
the entrypoint will automatically set the `CAPTCHA_DATASET` value for you based on directory names and number of files in each
|
||||||
|
|
||||||
|
to set `INSTANCES` pass a comma separated string of urls (FOURGET_INSTANCES = "https://4get.ca,https://domain.tld")
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
version: "3.7"
|
version: "3.7"
|
||||||
|
|
|
@ -25,6 +25,9 @@ function type_to_string($n) {
|
||||||
return $n ? 'true' : 'false';
|
return $n ? 'true' : 'false';
|
||||||
}
|
}
|
||||||
if ($type === "string") {
|
if ($type === "string") {
|
||||||
|
if(is_numeric($n)) {
|
||||||
|
return $n;
|
||||||
|
}
|
||||||
return "\"$n\"";
|
return "\"$n\"";
|
||||||
}
|
}
|
||||||
if ($type === "array") {
|
if ($type === "array") {
|
||||||
|
@ -49,7 +52,7 @@ function detect_captcha_dirs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$special_keys = ["CAPTCHA_DATASET"];
|
$special_keys = ["CAPTCHA_DATASET", "INSTANCES"];
|
||||||
|
|
||||||
$output = "<?php\n // This file was generated by docker/gen_config.php\n";
|
$output = "<?php\n // This file was generated by docker/gen_config.php\n";
|
||||||
|
|
||||||
|
@ -61,9 +64,12 @@ continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($key === "CAPTCHA_DATASET") {
|
if($key === "CAPTCHA_DATASET") {
|
||||||
$output = $output . "\tconst " . $key . " = " . type_to_string(detect_captcha_dirs()) . ";\n";
|
$output = $output . "\tconst " . $key . " = " . type_to_string(detect_captcha_dirs()) . ";\n";
|
||||||
}
|
}
|
||||||
|
if($key === "INSTANCES") {
|
||||||
|
$output = $output . "\tconst " . $key . " = " . type_to_string(explode(',', $val)) . ";\n";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue