config

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 10 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 */
	Port          string         `env:"PORT" default:"3552"`
	Listen        string         `env:"LISTEN" 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
	EncryptionKey string         `env:"ENCRYPTION_KEY" default:"arcane-dev-key-32-characters!!!" 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:""`

	DockerHost              string `env:"DOCKER_HOST" default:"unix:///var/run/docker.sock"`
	ProjectsDirectory       string `env:"PROJECTS_DIRECTORY" default:"/app/data/projects"`
	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"`
	EdgeReconnectInterval   int    `env:"EDGE_RECONNECT_INTERVAL" default:"5"` // seconds

	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) 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