mirror of
https://github.com/matrix-construct/construct
synced 2025-04-12 04:51:07 +02:00
ircd::fs::path: Improve default precedence and expected behavior of path conf items. #138
This commit is contained in:
parent
f86a938a8a
commit
eb9cc07767
1 changed files with 54 additions and 74 deletions
|
@ -64,142 +64,122 @@ ircd::fs::name_scratch
|
|||
/// env=ircd_fs_base_prefix
|
||||
decltype(ircd::fs::base::prefix)
|
||||
ircd::fs::base::prefix
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.prefix" },
|
||||
{ "default", RB_PREFIX },
|
||||
{ "persist", false },
|
||||
{ "help", "directory prefix" },
|
||||
{ "default", getenv("IRCD_PREFIX")?:
|
||||
RB_PREFIX
|
||||
},
|
||||
nullptr
|
||||
};
|
||||
|
||||
/// e.g. /usr/bin default=RB_BIN_DIR
|
||||
/// env=ircd_fs_base_bin
|
||||
decltype(ircd::fs::base::bin)
|
||||
ircd::fs::base::bin
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.bin" },
|
||||
{ "default", RB_BIN_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "binary directory" },
|
||||
{ "default", getenv("IRCD_BIN_DIR")?:
|
||||
RB_BIN_DIR
|
||||
},
|
||||
nullptr
|
||||
};
|
||||
|
||||
/// e.g. /etc default=RB_CONF_DIR
|
||||
/// env=$ircd_fs_base_etc env=$CONFIGURATION_DIRECTORY
|
||||
decltype(ircd::fs::base::etc)
|
||||
ircd::fs::base::etc
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.etc" },
|
||||
{ "default", RB_CONF_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "configuration directory" },
|
||||
}, []
|
||||
{
|
||||
string_view env;
|
||||
if((env = getenv("CONFIGURATION_DIRECTORY")))
|
||||
etc._value = env;
|
||||
}
|
||||
{ "default", getenv("CONFIGURATION_DIRECTORY")?:
|
||||
getenv("IRCD_CONF_DIR")?:
|
||||
RB_CONF_DIR
|
||||
},
|
||||
};
|
||||
|
||||
/// e.g. /usr/lib default=RB_LIB_DIR
|
||||
/// env=$ircd_fs_base_lib
|
||||
decltype(ircd::fs::base::lib)
|
||||
ircd::fs::base::lib
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.lib" },
|
||||
{ "default", RB_LIB_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "library directory" },
|
||||
{ "default", getenv("IRCD_LIB_DIR")?:
|
||||
RB_LIB_DIR
|
||||
},
|
||||
nullptr
|
||||
};
|
||||
|
||||
/// e.g. /usr/lib/modules/construct default=RB_MODULE_DIR
|
||||
/// env=$ircd_fs_base_modules
|
||||
decltype(ircd::fs::base::modules)
|
||||
ircd::fs::base::modules
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.modules" },
|
||||
{ "default", RB_MODULE_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "modules directory" },
|
||||
{ "default", getenv("IRCD_MODULE_DIR")?:
|
||||
RB_MODULE_DIR
|
||||
},
|
||||
nullptr
|
||||
};
|
||||
|
||||
/// e.g. /usr/share/construct default=RB_DATA_DIR
|
||||
/// env=$ircd_fs_base_share
|
||||
decltype(ircd::fs::base::share)
|
||||
ircd::fs::base::share
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.share" },
|
||||
{ "default", RB_DATA_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "read-only data directory" },
|
||||
{ "default", getenv("IRCD_DATA_DIR")?:
|
||||
RB_DATA_DIR
|
||||
},
|
||||
nullptr
|
||||
};
|
||||
|
||||
/// e.g. /var/run/construct default=RB_RUN_DIR
|
||||
/// env=$ircd_fs_base_run env=$RUNTIME_DIRECTORY
|
||||
decltype(ircd::fs::base::run)
|
||||
ircd::fs::base::run
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.run" },
|
||||
{ "default", RB_RUN_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "runtime directory" },
|
||||
}, []
|
||||
{
|
||||
string_view env;
|
||||
if((env = getenv("RUNTIME_DIRECTORY")))
|
||||
run._value = env;
|
||||
}
|
||||
{ "default", getenv("RUNTIME_DIRECTORY")?:
|
||||
getenv("IRCD_RUN_DIR")?:
|
||||
RB_RUN_DIR
|
||||
},
|
||||
};
|
||||
|
||||
/// e.g. /var/log/construct default=RB_LOG_DIR
|
||||
/// env=$ircd_fs_base_log env=$LOGS_DIRECTORY
|
||||
decltype(ircd::fs::base::log)
|
||||
ircd::fs::base::log
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.log" },
|
||||
{ "default", RB_LOG_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "logging directory" },
|
||||
}, []
|
||||
{
|
||||
string_view env;
|
||||
if((env = getenv("LOGS_DIRECTORY")))
|
||||
log._value = env;
|
||||
}
|
||||
{ "default", getenv("LOGS_DIRECTORY")?:
|
||||
getenv("IRCD_LOG_DIR")?:
|
||||
RB_LOG_DIR
|
||||
},
|
||||
};
|
||||
|
||||
/// e.g. /var/db/construct default=RB_DB_DIR
|
||||
/// env=$ircd_fs_base_db env=$STATE_DIRECTORY
|
||||
decltype(ircd::fs::base::db)
|
||||
ircd::fs::base::db
|
||||
{
|
||||
{
|
||||
{ "name", "ircd.fs.base.db" },
|
||||
{ "default", RB_DB_DIR },
|
||||
{ "persist", false },
|
||||
{ "help", "database directory" },
|
||||
}, []
|
||||
{
|
||||
string_view env;
|
||||
if((env = getenv("STATE_DIRECTORY")))
|
||||
db._value = env;
|
||||
}
|
||||
{ "default", getenv("STATE_DIRECTORY")?:
|
||||
getenv("IRCD_DB_DIR")?:
|
||||
RB_DB_DIR
|
||||
},
|
||||
};
|
||||
|
||||
std::string
|
||||
|
|
Loading…
Add table
Reference in a new issue