Skip to content

Commit

Permalink
feat(config): Allow loading extra config from file
Browse files Browse the repository at this point in the history
  • Loading branch information
dasJ committed Jan 11, 2023
1 parent 842fa97 commit 8654f39
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SoObjects/SOGo/SOGoSystemDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#import <Foundation/NSFileManager.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSProcessInfo.h>

#import <NGExtensions/NSObject+Logs.h>

Expand Down Expand Up @@ -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];
Expand All @@ -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
Expand Down

0 comments on commit 8654f39

Please sign in to comment.