MCPcopy
hub / github.com/gourouting/singo / confInit

Function confInit

test/init.go:27–47  ·  view source on GitHub ↗

confInit initializes configuration.

()

Source from the content-addressed store, hash-verified

25
26// confInit initializes configuration.
27func 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}

Callers 1

initFunction · 0.85

Calls 7

BuildLoggerFunction · 0.92
LoadLocalesFunction · 0.92
LogFunction · 0.92
DatabaseDSNFunction · 0.92
DatabaseFunction · 0.92
RedisFunction · 0.92
PanicMethod · 0.80

Tested by

no test coverage detected