Get returns the configuration extracted from env variables or config file.
()
| 66 | |
| 67 | // Get returns the configuration extracted from env variables or config file. |
| 68 | func 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 | |
| 78 | func addTrailingSlashToPaths(conf *Configuration) { |
| 79 | if !strings.HasSuffix(conf.UploadedImagesDir, "/") && !strings.HasSuffix(conf.UploadedImagesDir, "\\") { |