confInit initializes configuration.
()
| 25 | |
| 26 | // confInit initializes configuration. |
| 27 | func confInit() { |
| 28 | // Load environment variables from local files. |
| 29 | godotenv.Load() |
| 30 | |
| 31 | // Set the log level. |
| 32 | util.BuildLogger(os.Getenv("LOG_LEVEL")) |
| 33 | |
| 34 | // Load translation files. |
| 35 | if err := conf.LoadLocales("../conf/locales/zh-cn.yaml"); err != nil { |
| 36 | util.Log().Panic("failed to load translation file: %v", err) |
| 37 | } |
| 38 | |
| 39 | // Connect to the database. |
| 40 | dsn, err := conf.DatabaseDSN() |
| 41 | if err != nil { |
| 42 | panic(err) |
| 43 | } |
| 44 | |
| 45 | model.Database(dsn) |
| 46 | cache.Redis() |
| 47 | } |
no test coverage detected