forked from mtusi2026/mtusi2026lab2
Реализация на 4
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"gitea.privcloud.tech/mtusi2026/internal/pkg/environment"
|
||||
"gitea.privcloud.tech/mtusi2026/internal/pkg/types/environment"
|
||||
)
|
||||
|
||||
var defaultConfig = &Config{
|
||||
@@ -44,14 +43,6 @@ var defaultConfig = &Config{
|
||||
PublicKeyPath: "certs/private.pem",
|
||||
PrivateKeyPath: "certs/public.pem",
|
||||
},
|
||||
Cookies: &Cookies{
|
||||
Enabled: true,
|
||||
Domain: "",
|
||||
Path: "/",
|
||||
Secure: true,
|
||||
SameSite: http.SameSiteStrictMode,
|
||||
AllowedOrigins: []string{"http:localhost:8080"},
|
||||
},
|
||||
Application: &Application{
|
||||
LogLevel: "info",
|
||||
ShutdownTimeout: 10 * time.Second,
|
||||
@@ -65,7 +56,6 @@ type Config struct {
|
||||
Postgres *Postgres
|
||||
Redis *Redis
|
||||
JWT *JWT
|
||||
Cookies *Cookies
|
||||
Application *Application
|
||||
}
|
||||
|
||||
@@ -93,7 +83,6 @@ func (c *Config) Validate() error {
|
||||
c.Postgres.Validate(),
|
||||
c.JWT.Validate(),
|
||||
c.Redis.Validate(),
|
||||
c.Cookies.Validate(),
|
||||
c.Application.Validate(),
|
||||
)
|
||||
}
|
||||
@@ -104,7 +93,6 @@ func (c *Config) loadConfig(v *viper.Viper) error {
|
||||
c.Server.loadConfig(v),
|
||||
c.JWT.loadConfig(v),
|
||||
c.Redis.loadConfig(v),
|
||||
c.Cookies.loadConfig(v),
|
||||
c.Application.loadConfig(v),
|
||||
)
|
||||
}
|
||||
@@ -115,7 +103,6 @@ func (c *Config) copy() *Config {
|
||||
Postgres: c.Postgres.copy(),
|
||||
Redis: c.Redis.copy(),
|
||||
JWT: c.JWT.copy(),
|
||||
Cookies: c.Cookies.copy(),
|
||||
Application: c.Application.copy(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user