1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-04 09:51:46 +00:00

fix: ENCRYPTION_KEY needed for version and help commands (#1256)

This commit is contained in:
Kyle Mendell
2026-01-18 18:04:53 -06:00
committed by GitHub
parent 0978a89fcc
commit c62533d388

View File

@@ -129,6 +129,10 @@ func parseEnvConfig() error {
// ValidateEnvConfig checks the EnvConfig for required fields and valid values
func ValidateEnvConfig(config *EnvConfigSchema) error {
if shouldSkipEnvValidation(os.Args) {
return nil
}
if _, err := sloggin.ParseLevel(config.LogLevel); err != nil {
return errors.New("invalid LOG_LEVEL value. Must be 'debug', 'info', 'warn' or 'error'")
}
@@ -210,6 +214,17 @@ func ValidateEnvConfig(config *EnvConfigSchema) error {
}
func shouldSkipEnvValidation(args []string) bool {
for _, arg := range args[1:] {
switch arg {
case "-h", "--help", "help", "version":
return true
}
}
return false
}
// prepareEnvConfig processes special options for EnvConfig fields
func prepareEnvConfig(config *EnvConfigSchema) error {
val := reflect.ValueOf(config).Elem()