Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"
	Revision  = "unknown"
	BuildTime = "unknown"
)

Functions

func GoVersion

func GoVersion() string

GoVersion returns the Go runtime version

func ShortRevision

func ShortRevision() string

ShortRevision returns the first 8 characters of the revision hash

Types

type AppEnvironment

type AppEnvironment string
const (
	AppEnvironmentProduction  AppEnvironment = "production"
	AppEnvironmentDevelopment AppEnvironment = "development"
	AppEnvironmentTest        AppEnvironment = "test"
)

func (AppEnvironment) IsProdEnvironment

func (a AppEnvironment) IsProdEnvironment() bool

func (AppEnvironment) IsTestEnvironment

func (a AppEnvironment) IsTestEnvironment() bool

type BuildablesConfig

type BuildablesConfig struct {
	AutoLoginUsername string
	AutoLoginPassword string
}

BuildablesConfig provides stub fields when buildables are not enabled. This keeps references compile-safe while avoiding env-based configuration.

type Config

type Config struct {
	AppUrl            string         `env:"APP_URL" default:"http://localhost:3552"`
	DatabaseURL       string         `` /* 134-byte string literal not displayed */
	AllowDowngrade    bool           `env:"ALLOW_DOWNGRADE" default:"false"`
	Port              string         `env:"PORT" default:"3552"`
	Listen            string         `env:"LISTEN" default:""`
	TLSEnabled        bool           `env:"TLS_ENABLED" default:"false"`
	TLSCertFile       string         `env:"TLS_CERT_FILE" default:""`
	TLSKeyFile        string         `env:"TLS_KEY_FILE" default:""`
	Environment       AppEnvironment `env:"ENVIRONMENT" default:"production"`
	JWTSecret         string         `env:"JWT_SECRET" default:"default-jwt-secret-change-me" options:"file"` //nolint:gosec // configuration field name is part of stable config API
	JWTRefreshExpiry  time.Duration  `env:"JWT_REFRESH_EXPIRY" default:"168h"`
	EncryptionKey     string         `env:"ENCRYPTION_KEY" default:"arcane-dev-key-32-characters!!!" options:"file"`
	AdminStaticAPIKey string         `env:"ADMIN_STATIC_API_KEY" default:"" options:"file"`

	OidcEnabled                bool   `env:"OIDC_ENABLED" default:"false"`
	OidcClientID               string `env:"OIDC_CLIENT_ID" default:"" options:"file"`
	OidcClientSecret           string `env:"OIDC_CLIENT_SECRET" default:"" options:"file"`
	OidcIssuerURL              string `env:"OIDC_ISSUER_URL" default:""`
	OidcScopes                 string `env:"OIDC_SCOPES" default:"openid email profile"`
	OidcAdminClaim             string `env:"OIDC_ADMIN_CLAIM" default:""`
	OidcAdminValue             string `env:"OIDC_ADMIN_VALUE" default:""`
	OidcSkipTlsVerify          bool   `env:"OIDC_SKIP_TLS_VERIFY" default:"false"`
	OidcAutoRedirectToProvider bool   `env:"OIDC_AUTO_REDIRECT_TO_PROVIDER" default:"false"`
	OidcProviderName           string `env:"OIDC_PROVIDER_NAME" default:""`
	OidcProviderLogoUrl        string `env:"OIDC_PROVIDER_LOGO_URL" default:""`
	OidcMobileRedirectUris     string `env:"OIDC_MOBILE_REDIRECT_URIS" default:"arcane-mobile://oidc-callback"`

	PUID                    string `env:"PUID" default:""`
	PGID                    string `env:"PGID" default:""`
	DockerHost              string `env:"DOCKER_HOST" default:"unix:///var/run/docker.sock"`
	DockerConfig            string `env:"DOCKER_CONFIG" default:""`
	ProjectsDirectory       string `env:"PROJECTS_DIRECTORY" default:"/app/data/projects"`
	TemplatesDirectory      string `env:"TEMPLATES_DIRECTORY" default:"/app/data/templates"`
	ProjectScanMaxDepth     int    `env:"PROJECT_SCAN_MAX_DEPTH" default:"3"`
	ProjectScanSkipDirs     string `` /* 135-byte string literal not displayed */
	LogJson                 bool   `env:"LOG_JSON" default:"false"`
	LogLevel                string `env:"LOG_LEVEL" default:"info" options:"toLower"`
	AgentMode               bool   `env:"AGENT_MODE" default:"false"`
	AgentToken              string `env:"AGENT_TOKEN" default:"" options:"file"`
	ManagerApiUrl           string `env:"MANAGER_API_URL" default:""`
	UpdateCheckDisabled     bool   `env:"UPDATE_CHECK_DISABLED" default:"false"`
	UIConfigurationDisabled bool   `env:"UI_CONFIGURATION_DISABLED" default:"false"`
	AnalyticsDisabled       bool   `env:"ANALYTICS_DISABLED" default:"false"`
	GPUMonitoringEnabled    bool   `env:"GPU_MONITORING_ENABLED" default:"false"`
	GPUType                 string `env:"GPU_TYPE" default:"auto"`
	EdgeAgent               bool   `env:"EDGE_AGENT" default:"false"`
	EdgeTransport           string `env:"EDGE_TRANSPORT" default:"auto" options:"toLower"`
	EdgeReconnectInterval   int    `env:"EDGE_RECONNECT_INTERVAL" default:"5"` // seconds
	EdgeMTLSMode            string `env:"EDGE_MTLS_MODE" default:"disabled" options:"toLower"`
	EdgeMTLSCAFile          string `env:"EDGE_MTLS_CA_FILE" default:""`
	EdgeMTLSCertFile        string `env:"EDGE_MTLS_CERT_FILE" default:""`
	EdgeMTLSKeyFile         string `env:"EDGE_MTLS_KEY_FILE" default:""`
	EdgeMTLSServerName      string `env:"EDGE_MTLS_SERVER_NAME" default:""`
	EdgeMTLSAssetsDir       string `env:"EDGE_MTLS_ASSETS_DIR" default:""`

	TrustedProxies string `env:"TRUSTED_PROXIES" default:""`

	FilePerm   os.FileMode `env:"FILE_PERM" default:"0644"`
	DirPerm    os.FileMode `env:"DIR_PERM" default:"0755"`
	GitWorkDir string      `env:"GIT_WORK_DIR" default:"data/git"`

	DockerAPITimeout       int    `env:"DOCKER_API_TIMEOUT" default:"0"`
	DockerImagePullTimeout int    `env:"DOCKER_IMAGE_PULL_TIMEOUT" default:"0"`
	TrivyScanTimeout       int    `env:"TRIVY_SCAN_TIMEOUT" default:"0"`
	GitOperationTimeout    int    `env:"GIT_OPERATION_TIMEOUT" default:"0"`
	HTTPClientTimeout      int    `env:"HTTP_CLIENT_TIMEOUT" default:"0"`
	RegistryTimeout        int    `env:"REGISTRY_TIMEOUT" default:"0"`
	ProxyRequestTimeout    int    `env:"PROXY_REQUEST_TIMEOUT" default:"0"`
	BackupVolumeName       string `env:"ARCANE_BACKUP_VOLUME_NAME" default:"arcane-backups"`

	// Timezone for cron job scheduling. Uses IANA timezone names (e.g., "America/New_York", "Europe/London").
	// "Local" uses the system's local timezone, "UTC" for Coordinated Universal Time.
	Timezone string `env:"TZ" default:"Local"`

	// BuildablesConfig contains feature-specific configuration that can be conditionally compiled
	BuildablesConfig
}

Config holds all application configuration. Fields tagged with `env` will be loaded from the corresponding environment variable. Fields with `options:"file"` support Docker secrets via the _FILE suffix. Available options: file, toLower, trimTrailingSlash

func Load

func Load() *Config

func (*Config) GetAppURL

func (c *Config) GetAppURL() string

GetAppURL returns the effective application URL. If in agent mode and APP_URL is not explicitly set, it returns the manager's URL.

func (*Config) GetLocation

func (c *Config) GetLocation() *time.Location

GetLocation returns the timezone location for cron scheduling. It parses the Timezone config (TZ env var) into a *time.Location. Returns the system's local timezone if Timezone is "Local". Defaults to UTC if not set or if the timezone cannot be loaded.

func (*Config) GetManagerBaseURL

func (c *Config) GetManagerBaseURL() string

GetManagerBaseURL returns the base URL of the manager application. It strips any trailing slashes or /api suffix from MANAGER_API_URL.

func (*Config) GetManagerGRPCAddr added in v1.16.0

func (c *Config) GetManagerGRPCAddr() string

GetManagerGRPCAddr returns the manager gRPC address in host:port form.

func (*Config) ListenAddr

func (c *Config) ListenAddr() string

ListenAddr returns the effective address for the HTTP server to bind to. It uses LISTEN as the host (if set) and PORT for the port.

func (*Config) MaskSensitive

func (c *Config) MaskSensitive() map[string]any

MaskSensitive returns a copy of the config with sensitive fields masked. Useful for logging configuration without exposing secrets.

Jump to

Keyboard shortcuts

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