mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-22 17:25:06 +03:00
fix: ignore trailing slashes in APP_URL
This commit is contained in:
@@ -35,7 +35,7 @@ const (
|
|||||||
type EnvConfigSchema struct {
|
type EnvConfigSchema struct {
|
||||||
AppEnv string `env:"APP_ENV" options:"toLower"`
|
AppEnv string `env:"APP_ENV" options:"toLower"`
|
||||||
LogLevel string `env:"LOG_LEVEL" options:"toLower"`
|
LogLevel string `env:"LOG_LEVEL" options:"toLower"`
|
||||||
AppURL string `env:"APP_URL" options:"toLower"`
|
AppURL string `env:"APP_URL" options:"toLower,trimTrailingSlash"`
|
||||||
DbProvider DbProvider `env:"DB_PROVIDER" options:"toLower"`
|
DbProvider DbProvider `env:"DB_PROVIDER" options:"toLower"`
|
||||||
DbConnectionString string `env:"DB_CONNECTION_STRING" options:"file"`
|
DbConnectionString string `env:"DB_CONNECTION_STRING" options:"file"`
|
||||||
UploadPath string `env:"UPLOAD_PATH"`
|
UploadPath string `env:"UPLOAD_PATH"`
|
||||||
@@ -227,6 +227,10 @@ func prepareEnvConfig(config *EnvConfigSchema) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
case "trimTrailingSlash":
|
||||||
|
if field.Kind() == reflect.String {
|
||||||
|
field.SetString(strings.TrimRight(field.String(), "/"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user