MCPcopy
hub / github.com/gotify/server / Get

Function Get

config/config.go:68–76  ·  view source on GitHub ↗

Get returns the configuration extracted from env variables or config file.

()

Source from the content-addressed store, hash-verified

66
67// Get returns the configuration extracted from env variables or config file.
68func Get() *Configuration {
69 conf := new(Configuration)
70 err := configor.New(&configor.Config{ENVPrefix: "GOTIFY", Silent: true}).Load(conf, configFiles()...)
71 if err != nil {
72 panic(err)
73 }
74 addTrailingSlashToPaths(conf)
75 return conf
76}
77
78func addTrailingSlashToPaths(conf *Configuration) {
79 if !strings.HasSuffix(conf.UploadedImagesDir, "/") && !strings.HasSuffix(conf.UploadedImagesDir, "\\") {

Callers 6

mainFunction · 0.92
TestConfigEnvFunction · 0.70
TestAddSlashFunction · 0.70
TestNotAddSlashFunction · 0.70
TestFileWithSyntaxErrorsFunction · 0.70
TestConfigFileFunction · 0.70

Calls 3

configFilesFunction · 0.85
addTrailingSlashToPathsFunction · 0.85
LoadMethod · 0.65

Tested by 5

TestConfigEnvFunction · 0.56
TestAddSlashFunction · 0.56
TestNotAddSlashFunction · 0.56
TestFileWithSyntaxErrorsFunction · 0.56
TestConfigFileFunction · 0.56