config

package
v1.40.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSessionCookieName = "console_session"

DefaultSessionCookieName names the HttpOnly cookie holding the session JWT.

Variables

View Source
var TrayMode bool

TrayMode indicates whether to run with system tray UI.

Functions

func SaveAdminPassword added in v1.28.0

func SaveAdminPassword(adminPassword string) error

SaveAdminPassword persists adminPassword to auth.adminPassword in config.yml without touching any other field. It re-reads the file directly (bypassing the env-var overlay applied by cleanenv) so env-only secrets like APP_ENCRYPTION_KEY, SECRETS_TOKEN, DB_URL, EA_PASSWORD, and AUTH_JWT_KEY cannot leak to disk.

Types

type App

type App struct {
	Name                 string `env-required:"true" yaml:"name" env:"APP_NAME"`
	Repo                 string `env-required:"true" yaml:"repo" env:"APP_REPO"`
	Version              string `env-required:"true"`
	CommonName           string `env-required:"true" yaml:"common_name" env:"APP_COMMON_NAME"`
	EncryptionKey        string `yaml:"encryption_key" env:"APP_ENCRYPTION_KEY"`
	AllowInsecureCiphers bool   `yaml:"allow_insecure_ciphers" env:"APP_ALLOW_INSECURE_CIPHERS"`
	DisableCIRA          bool   `yaml:"disable_cira" env:"APP_DISABLE_CIRA"`
}

App -.

type Auth

type Auth struct {
	Disabled                 bool          `yaml:"disabled" env:"AUTH_DISABLED"`
	AdminUsername            string        `yaml:"adminUsername" env:"AUTH_ADMIN_USERNAME"`
	AdminPassword            string        `yaml:"adminPassword" env:"AUTH_ADMIN_PASSWORD"`
	JWTKey                   string        `env-required:"true" yaml:"jwtKey" env:"AUTH_JWT_KEY"`
	JWTExpiration            time.Duration `yaml:"jwtExpiration" env:"AUTH_JWT_EXPIRATION"`
	RedirectionJWTExpiration time.Duration `yaml:"redirectionJWTExpiration" env:"AUTH_REDIRECTION_JWT_EXPIRATION"`
	ClientID                 string        `yaml:"clientId" env:"AUTH_CLIENT_ID"`
	Issuer                   string        `yaml:"issuer" env:"AUTH_ISSUER"`
	TLSSkipVerify            bool          `yaml:"tlsSkipVerify" env:"AUTH_TLS_SKIP_VERIFY"`
	CookieEnabled            bool          `yaml:"cookieEnabled" env:"AUTH_COOKIE_ENABLED"`
	CookieName               string        `yaml:"cookieName" env:"AUTH_COOKIE_NAME"`
	CookieSecure             bool          `yaml:"cookieSecure" env:"AUTH_COOKIE_SECURE"`
	CookieSameSite           string        `yaml:"cookieSameSite" env:"AUTH_COOKIE_SAME_SITE"`
	UI                       UIAuthConfig  `yaml:"ui"`
}

Auth -.

The Cookie* fields govern the HttpOnly session cookie the browser uses in place of Web Storage. Additive only: /authorize still returns the token in the body and the Authorization header still wins, so REST clients are unaffected.

func (Auth) CookieAuthEnabled added in v1.40.1

func (a Auth) CookieAuthEnabled() bool

CookieAuthEnabled reports whether the HttpOnly session cookie is in use. Off under OIDC, where the IdP owns the token. Read by the middleware and the spec.

type Config

type Config struct {
	App     `yaml:"app"`
	HTTP    `yaml:"http"`
	Log     `yaml:"logger"`
	Secrets `yaml:"secrets"`
	DB      `yaml:"postgres"`
	EA      `yaml:"ea"`
	Auth    `yaml:"auth"`
	UI      `yaml:"ui"`
}

Config -.

var ConsoleConfig *Config

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns app config.

type DB

type DB struct {
	Provider string `yaml:"provider" env:"DB_PROVIDER"`
	PoolMax  int    `env-required:"true" yaml:"pool_max" env:"DB_POOL_MAX"`
	URL      string `env:"DB_URL"`
}

DB -.

Provider selects the backend: "postgres", "sqlite" (default), or "mongo". See internal/app/repos.go for the per-provider rules around DB_URL.

type EA

type EA struct {
	URL      string `yaml:"url" env:"EA_URL"`
	Username string `yaml:"username" env:"EA_USERNAME"`
	Password string `yaml:"password" env:"EA_PASSWORD"`
}

EA -.

type HTTP

type HTTP struct {
	Host             string   `yaml:"host" env:"HTTP_HOST"`
	Port             string   `env-required:"true" yaml:"port" env:"HTTP_PORT"`
	AllowedOrigins   []string `env-required:"true" yaml:"allowed_origins" env:"HTTP_ALLOWED_ORIGINS"`
	AllowedHeaders   []string `env-required:"true" yaml:"allowed_headers" env:"HTTP_ALLOWED_HEADERS"`
	AllowCredentials bool     `yaml:"allow_credentials" env:"HTTP_ALLOW_CREDENTIALS"`
	WSCompression    bool     `yaml:"ws_compression" env:"WS_COMPRESSION"`
	TLS              TLS      `yaml:"tls"`
}

HTTP -.

type Log

type Log struct {
	Level string `env-required:"true" yaml:"log_level"   env:"LOG_LEVEL"`
}

Log -.

type Secrets added in v1.15.0

type Secrets struct {
	Address string `yaml:"address" env:"SECRETS_ADDR"`
	Token   string `yaml:"token" env:"SECRETS_TOKEN"`
	Path    string `yaml:"path" env:"SECRETS_PATH"`
}

Secrets -.

type TLS added in v1.13.0

type TLS struct {
	Enabled  bool   `yaml:"enabled" env:"HTTP_TLS_ENABLED"`
	CertFile string `yaml:"certFile" env:"HTTP_TLS_CERT_FILE"`
	KeyFile  string `yaml:"keyFile" env:"HTTP_TLS_KEY_FILE"`
}

TLS -.

type UI added in v1.18.0

type UI struct {
	ExternalURL string `yaml:"externalUrl" env:"UI_EXTERNAL_URL"`
}

UI -.

type UIAuthConfig

type UIAuthConfig struct {
	ClientID                          string `yaml:"clientId" env:"AUTH_UI_CLIENT_ID"`
	Issuer                            string `yaml:"issuer" env:"AUTH_UI_ISSUER"`
	RedirectURI                       string `yaml:"redirectUri" env:"AUTH_UI_REDIRECT_URI"`
	Scope                             string `yaml:"scope" env:"AUTH_UI_SCOPE"`
	ResponseType                      string `yaml:"responseType" env:"AUTH_UI_RESPONSE_TYPE"`
	RequireHTTPS                      bool   `yaml:"requireHttps" env:"AUTH_UI_REQUIRE_HTTPS"`
	StrictDiscoveryDocumentValidation bool   `yaml:"strictDiscoveryDocumentValidation" env:"AUTH_UI_STRICT_DISCOVERY"`
}

UIAuthConfig -.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL