From 8654f39cf5188321fd1b6d1a9df0f71d6c790912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Wed, 11 Jan 2023 19:18:47 +0100 Subject: [PATCH] feat(config): Allow loading extra config from file --- SoObjects/SOGo/SOGoSystemDefaults.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SoObjects/SOGo/SOGoSystemDefaults.m b/SoObjects/SOGo/SOGoSystemDefaults.m index fbd18c7db7..e9ffad953d 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.m +++ b/SoObjects/SOGo/SOGoSystemDefaults.m @@ -25,6 +25,7 @@ #import #import #import +#import #import @@ -143,7 +144,7 @@ + (void) prepareUserDefaults NSBundle *bundle; NSString *confFiles[] = {@"/etc/sogo/debconf.conf", @"/etc/sogo/sogo.conf"}; - NSString *filename, *redirectURL; + NSString *filename, *redirectURL, *envFile; NSUInteger count; logger = [SOGoStartupLogger sharedLogger]; @@ -163,6 +164,12 @@ + (void) prepareUserDefaults for (count = 0; count < sizeof(confFiles)/sizeof(confFiles[0]); count++) _injectConfigurationFromFile (configFromFiles, confFiles[count], logger); + /* Fill/Override configuration with configuration stored in the extra + * config file */ + envFile = [[[NSProcessInfo processInfo] environment] objectForKey:@"SOGO_EXTRA_CONFIG_FILE"]; + if (envFile) + _injectConfigurationFromFile (configFromFiles, envFile, logger); + /* This dance is required to let other appplications (sogo-tool) use * options from the sogod domain while preserving the order of precedence * - remove the 'sogod' domain from the user defaults search list