chore: refactor main

This commit is contained in:
2023-06-13 23:35:49 +02:00
parent e34f91fce6
commit e36fddb2b3
5 changed files with 33 additions and 26 deletions
+13 -13
View File
@@ -6,24 +6,14 @@ import (
"github.com/joho/godotenv"
)
var Slot = sl.NewSlot[Config]()
var TestingProductionConfig = Config{
Mode: "production",
Host: ":4000",
}
var TestingDevelopmentConfig = Config{
Mode: "development",
Host: ":4000",
}
type Config struct {
Mode string
Host string
}
func Load(l *sl.ServiceLocator) (Config, error) {
var Slot = sl.NewSlot[Config]()
func Configure(l *sl.ServiceLocator) (Config, error) {
m, err := godotenv.Read(".env")
if err != nil {
return Config{}, err
@@ -43,3 +33,13 @@ func Load(l *sl.ServiceLocator) (Config, error) {
return cfg, nil
}
var TestingProductionConfig = Config{
Mode: "production",
Host: ":4000",
}
var TestingDevelopmentConfig = Config{
Mode: "development",
Host: ":4000",
}