mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 19:06:04 -04:00
Set default data, state, config paths via env vars
Resolves https://github.com/unmojang/drasl/issues/119. May be useful for some containerized deployments.
This commit is contained in:
parent
f562e8b058
commit
32840a628e
@ -12,3 +12,15 @@ const LICENSE_URL = "https://www.gnu.org/licenses/gpl-3.0.en.html"
|
|||||||
const DEFAULT_DATA_DIRECTORY = "/usr/share/drasl"
|
const DEFAULT_DATA_DIRECTORY = "/usr/share/drasl"
|
||||||
const DEFAULT_STATE_DIRECTORY = "/var/lib/drasl"
|
const DEFAULT_STATE_DIRECTORY = "/var/lib/drasl"
|
||||||
const DEFAULT_CONFIG_DIRECTORY = "/etc/drasl"
|
const DEFAULT_CONFIG_DIRECTORY = "/etc/drasl"
|
||||||
|
|
||||||
|
func GetDefaultDataDirectory() string {
|
||||||
|
return Getenv("DRASL_DEFAULT_DATA_DIRECTORY", DEFAULT_DATA_DIRECTORY)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDefaultStateDirectory() string {
|
||||||
|
return Getenv("DRASL_DEFAULT_STATE_DIRECTORY", DEFAULT_STATE_DIRECTORY)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDefaultConfigDirectory() string {
|
||||||
|
return Getenv("DRASL_DEFAULT_CONFIG_DIRECTORY", DEFAULT_CONFIG_DIRECTORY)
|
||||||
|
}
|
||||||
|
@ -65,7 +65,7 @@ var Constants = &ConstantsType{
|
|||||||
MaxPlayerCountUnlimited: -1,
|
MaxPlayerCountUnlimited: -1,
|
||||||
MaxUsernameLength: 16,
|
MaxUsernameLength: 16,
|
||||||
MaxPlayerNameLength: 16,
|
MaxPlayerNameLength: 16,
|
||||||
ConfigDirectory: DEFAULT_CONFIG_DIRECTORY,
|
ConfigDirectory: GetDefaultConfigDirectory(),
|
||||||
Version: VERSION,
|
Version: VERSION,
|
||||||
License: LICENSE,
|
License: LICENSE,
|
||||||
LicenseURL: LICENSE_URL,
|
LicenseURL: LICENSE_URL,
|
||||||
|
@ -116,7 +116,7 @@ func DefaultConfig() Config {
|
|||||||
ApplicationOwner: "Anonymous",
|
ApplicationOwner: "Anonymous",
|
||||||
BaseURL: "",
|
BaseURL: "",
|
||||||
BodyLimit: defaultBodyLimitConfig,
|
BodyLimit: defaultBodyLimitConfig,
|
||||||
DataDirectory: DEFAULT_DATA_DIRECTORY,
|
DataDirectory: GetDefaultDataDirectory(),
|
||||||
DefaultAdmins: []string{},
|
DefaultAdmins: []string{},
|
||||||
DefaultPreferredLanguage: "en",
|
DefaultPreferredLanguage: "en",
|
||||||
DefaultMaxPlayerCount: 1,
|
DefaultMaxPlayerCount: 1,
|
||||||
@ -147,7 +147,7 @@ func DefaultConfig() Config {
|
|||||||
},
|
},
|
||||||
SignPublicKeys: true,
|
SignPublicKeys: true,
|
||||||
SkinSizeLimit: 128,
|
SkinSizeLimit: 128,
|
||||||
StateDirectory: DEFAULT_STATE_DIRECTORY,
|
StateDirectory: GetDefaultStateDirectory(),
|
||||||
TestMode: false,
|
TestMode: false,
|
||||||
TokenExpireSec: 0,
|
TokenExpireSec: 0,
|
||||||
TokenStaleSec: 0,
|
TokenStaleSec: 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user