Skip to content

Commit

Permalink
master: Move import_environment setting to lib-master's master_servic…
Browse files Browse the repository at this point in the history
…e_settings
  • Loading branch information
sirainen committed Sep 14, 2017
1 parent 6eacca9 commit 2a7c4f9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
15 changes: 15 additions & 0 deletions src/lib-master/master-service-settings.c
Expand Up @@ -42,6 +42,7 @@ static const struct setting_define master_service_setting_defines[] = {
DEF(SET_STR, debug_log_path),
DEF(SET_STR, log_timestamp),
DEF(SET_STR, syslog_facility),
DEF(SET_STR, import_environment),
DEF(SET_SIZE, config_cache_size),
DEF(SET_BOOL, version_ignore),
DEF(SET_BOOL, shutdown_clients),
Expand All @@ -53,6 +54,19 @@ static const struct setting_define master_service_setting_defines[] = {
SETTING_DEFINE_LIST_END
};

/* <settings checks> */
#ifdef HAVE_SYSTEMD
# define ENV_SYSTEMD " LISTEN_PID LISTEN_FDS"
#else
# define ENV_SYSTEMD ""
#endif
#ifdef DEBUG
# define ENV_GDB " GDB DEBUG_SILENT"
#else
# define ENV_GDB ""
#endif
/* </settings checks> */

static const struct master_service_settings master_service_default_settings = {
.base_dir = PKG_RUNDIR,
.state_dir = PKG_STATEDIR,
Expand All @@ -61,6 +75,7 @@ static const struct master_service_settings master_service_default_settings = {
.debug_log_path = "",
.log_timestamp = DEFAULT_FAILURE_STAMP_FORMAT,
.syslog_facility = "mail",
.import_environment = "TZ CORE_OUTOFMEM CORE_ERROR" ENV_SYSTEMD ENV_GDB,
.config_cache_size = 1024*1024,
.version_ignore = FALSE,
.shutdown_clients = TRUE,
Expand Down
1 change: 1 addition & 0 deletions src/lib-master/master-service-settings.h
Expand Up @@ -15,6 +15,7 @@ struct master_service_settings {
const char *debug_log_path;
const char *log_timestamp;
const char *syslog_facility;
const char *import_environment;
uoff_t config_cache_size;
bool version_ignore;
bool shutdown_clients;
Expand Down
5 changes: 3 additions & 2 deletions src/master/main.c
Expand Up @@ -421,7 +421,8 @@ static struct master_settings *master_settings_read(void)
return master_service_settings_get_others(master_service)[0];
}

static void master_set_import_environment(const struct master_settings *set)
static void
master_set_import_environment(const struct master_service_settings *set)
{
const char *const *envs, *key, *value;
ARRAY_TYPE(const_string) keys;
Expand Down Expand Up @@ -845,7 +846,7 @@ int main(int argc, char *argv[])
fatal_log_check(set);

T_BEGIN {
master_set_import_environment(set);
master_set_import_environment(master_service_settings_get(master_service));
} T_END;
master_service_env_clean();

Expand Down
15 changes: 0 additions & 15 deletions src/master/master-settings.c
Expand Up @@ -178,7 +178,6 @@ static const struct setting_define master_setting_defines[] = {
DEF(SET_STR, state_dir),
DEF(SET_STR, libexec_dir),
DEF(SET_STR, instance_name),
DEF(SET_STR, import_environment),
DEF(SET_STR, protocols),
DEF(SET_STR, listen),
DEF(SET_ENUM, ssl),
Expand All @@ -201,25 +200,11 @@ static const struct setting_define master_setting_defines[] = {
SETTING_DEFINE_LIST_END
};

/* <settings checks> */
#ifdef HAVE_SYSTEMD
# define ENV_SYSTEMD " LISTEN_PID LISTEN_FDS"
#else
# define ENV_SYSTEMD ""
#endif
#ifdef DEBUG
# define ENV_GDB " GDB DEBUG_SILENT"
#else
# define ENV_GDB ""
#endif
/* </settings checks> */

static const struct master_settings master_default_settings = {
.base_dir = PKG_RUNDIR,
.state_dir = PKG_STATEDIR,
.libexec_dir = PKG_LIBEXECDIR,
.instance_name = PACKAGE,
.import_environment = "TZ CORE_OUTOFMEM CORE_ERROR" ENV_SYSTEMD ENV_GDB,
.protocols = "imap pop3 lmtp",
.listen = "*, ::",
.ssl = "yes:no:required",
Expand Down
1 change: 0 additions & 1 deletion src/master/master-settings.h
Expand Up @@ -8,7 +8,6 @@ struct master_settings {
const char *state_dir;
const char *libexec_dir;
const char *instance_name;
const char *import_environment;
const char *protocols;
const char *listen;
const char *ssl;
Expand Down

0 comments on commit 2a7c4f9

Please sign in to comment.