chore: refactor main
This commit is contained in:
+13
-13
@@ -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",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user