This commit is contained in:
2022-12-02 21:14:14 +02:00
commit dbe93cfc58
13 changed files with 338 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<?php
if ($argc != 3) {
die('error: invalid arg count');
}
$config_path = $argv[1];
$file_path = $argv[2];
$config = json_decode(file_get_contents($config_path), true);
$content = file_get_contents($file_path);
foreach ($config as $key => $value) {
/**
* Transform from json to native config types
*/
// switch ($key) {
// case 'POSTGREY_WHITELIST_DOMAINS':
// $value = implode("\n", $value);
// break;
// case 'POSTFIXADMIN_SETUP_PASSWORD':
// $value = password_hash($value, '2y');
// break;
// case 'ROUNDCUBE_PLUGIN_ALIAS_ADDRESSBOOK_DOMAINS':
// $value = json_encode($value);
// break;
// case 'ROUNDCUBE_PLUGIN_ALIAS_ADDRESSBOOK_USERS':
// $value = json_encode($value);
// break;
// case 'ROUNDCUBE_PLUGIN_X2FA_ENABLED_METHODS':
// $value = json_encode($value);
// break;
// }
$content = str_replace('{{' . $key . '}}', $value, $content);
}
exit(file_put_contents($file_path, $content) === false ? 1 : 0);