Skip to content

Commit

Permalink
Improved #1197
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Jul 3, 2023
1 parent 2f746cb commit eab3d8d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@ public function run(IOutput $output) {
// check if admins provided additional/custom initial config file
// https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#setting-a-single-configuration-value
// ex: php occ config:app:set snappymail custom_config_file --value="/path/to/config.php"
// https://github.com/the-djmaze/snappymail/pull/1197
try {
/** @var IConfig $ncConfig */
$ncConfig = \OC::$server->get(IConfig::class);
$customConfigFile = $ncConfig->getAppValue(Application::APP_ID, 'custom_config_file');
if ($customConfigFile && strpos($customConfigFile, ':') === false) {
include $customConfigFile;
if ($customConfigFile) {
if (!\str_contains($customConfigFile, ':') && \is_readable($customConfigFile)) {
require $customConfigFile;
} else {
throw new \Exception("not found {$customConfigFile}");
}
}
} catch (\Throwable $e) {
$output->warning("custom config error: " . $e->getMessage());
Expand Down

0 comments on commit eab3d8d

Please sign in to comment.