Files
tinyauth/internal/utils/loaders/loader_env.go
Stavros 061d28f5e3 refactor: use tinyauthapp/paerser instead of traefik/paerser (#781)
* refactor: use own paerser library instead of traefik

* chore: remove submodules from release images and workflows
2026-04-10 17:36:13 +03:00

27 lines
613 B
Go

package loaders
import (
"fmt"
"os"
"github.com/steveiliop56/tinyauth/internal/config"
"github.com/tinyauthapp/paerser/cli"
"github.com/tinyauthapp/paerser/env"
)
type EnvLoader struct{}
func (e *EnvLoader) Load(_ []string, cmd *cli.Command) (bool, error) {
vars := env.FindPrefixedEnvVars(os.Environ(), config.DefaultNamePrefix, cmd.Configuration)
if len(vars) == 0 {
return false, nil
}
if err := env.Decode(vars, config.DefaultNamePrefix, cmd.Configuration); err != nil {
return false, fmt.Errorf("failed to decode configuration from environment variables: %w", err)
}
return true, nil
}