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

Function Init

conf/conf.go:84–105  ·  view source on GitHub ↗

Init initializes configuration.

()

Source from the content-addressed store, hash-verified

82
83// Init initializes configuration.
84func Init() error {
85 // Load environment variables from local files.
86 godotenv.Load()
87
88 // Set the log level.
89 util.BuildLogger(os.Getenv("LOG_LEVEL"))
90
91 // Load translation files.
92 if err := LoadLocales("conf/locales/zh-cn.yaml"); err != nil {
93 return fmt.Errorf("load locales: %w", err)
94 }
95
96 // Connect to the database.
97 dsn, err := DatabaseDSN()
98 if err != nil {
99 return err
100 }
101
102 model.Database(dsn)
103 cache.Redis()
104 return nil
105}

Callers 1

mainFunction · 0.92

Calls 5

BuildLoggerFunction · 0.92
DatabaseFunction · 0.92
RedisFunction · 0.92
LoadLocalesFunction · 0.85
DatabaseDSNFunction · 0.85

Tested by

no test coverage detected