config

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Init

func Init()

func IsProduction

func IsProduction() bool

Types

type CacheMode

type CacheMode string

CacheMode has the following constants: CacheModeMemory, CacheModeRedis

const (
	CacheModeMemory CacheMode = "memory"
	CacheModeRedis  CacheMode = "redis"
)

type Config

type Config struct {
	Server   ServerConfig `yaml:"server"`
	Frontend struct {
		ExternalUrl string `yaml:"externalUrl"`
	} `yaml:"frontend"`
	Database             DatabaseConfig             `yaml:"database"`
	InitialVirtualServer InitialVirtualServerConfig `yaml:"initialVirtualServer"`
	KeyStore             KeyStoreConfig             `yaml:"keyStore"`
	Cache                struct {
		Mode  CacheMode `yaml:"mode"`
		Redis struct {
			Host     string `yaml:"host"`
			Port     int    `yaml:"port"`
			Username string `yaml:"username"`
			Password string `yaml:"password"`
			Database int    `yaml:"database"`
		} `yaml:"redis"`
	} `yaml:"cache"`
	LeaderElection LeaderElectionConfig `yaml:"leaderElection"`
}
var C Config

type DatabaseConfig

type DatabaseConfig struct {
	Mode     DatabaseMode   `yaml:"mode"`
	Postgres PostgresConfig `yaml:"postgres"`
	Sqlite   struct {
		Database string `yaml:"database"`
	} `yaml:"sqlite"`
}

type DatabaseMode

type DatabaseMode string

DatabaseMode has the following constants: DatabaseModePostgres, DatabaseModeSqlite

const (
	DatabaseModePostgres DatabaseMode = "postgres"
	DatabaseModeSqlite   DatabaseMode = "sqlite"
	DatabaseModeMemory   DatabaseMode = "memory"
)

type InitialProjectConfig

type InitialProjectConfig struct {
	Slug        string `yaml:"slug"`
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Roles       []struct {
		Name        string `yaml:"name"`
		Description string `yaml:"description"`
	} `yaml:"roles"`
	Applications []struct {
		Name                   string   `yaml:"name"`
		DisplayName            string   `yaml:"displayName"`
		Type                   string   `yaml:"type"`
		HashedSecret           *string  `yaml:"hashedSecret,omitempty"`
		RedirectUris           []string `yaml:"redirectUris"`
		PostLogoutRedirectUris []string `yaml:"postLogoutRedirectUris"`
		DeviceFlowEnabled      bool     `yaml:"deviceFlowEnabled"`
	} `yaml:"applications"`
	ResourceServers []struct {
		Slug        string `yaml:"slug"`
		Name        string `yaml:"name"`
		Description string `yaml:"description"`
	} `yaml:"resourceServers"`
}

type InitialVirtualServerConfig added in v0.3.5

type InitialVirtualServerConfig struct {
	Name                  string           `yaml:"name"`
	DisplayName           string           `yaml:"displayName"`
	EnableRegistration    bool             `yaml:"enableRegistration"`
	SigningAlgorithm      SigningAlgorithm `yaml:"signingAlgorithm"`
	CreateSystemAdminRole bool             `yaml:"createSystemAdminRole"`
	CreateAdmin           bool             `yaml:"createAdmin"`
	Admin                 struct {
		Username     string   `yaml:"username"`
		DisplayName  string   `yaml:"displayName"`
		PrimaryEmail string   `yaml:"primaryEmail"`
		PasswordHash string   `yaml:"passwordHash"`
		Roles        []string `yaml:"roles"`
	} `yaml:"admin"`
	ServiceUsers []ServiceUserConfig    `yaml:"serviceUsers"`
	Projects     []InitialProjectConfig `yaml:"projects"`
	Mail         struct {
		Host     string `yaml:"host"`
		Port     int    `yaml:"port"`
		Username string `yaml:"username"`
		Password string `yaml:"password"`
	} `yaml:"mail"`
}

type KeyStoreConfig

type KeyStoreConfig struct {
	Mode      KeyStoreMode        `yaml:"mode"`
	Vault     VaultKeyStoreConfig `yaml:"vault"`
	Directory struct {
		Path string `yaml:"path"`
	} `yaml:"directory"`
}

type KeyStoreMode

type KeyStoreMode string

KeyStoreMode has the following constants: KeyStoreModeMemory (testing only), KeyStoreModeDirectory, KeyStoreModeOpenBao

const (
	KeyStoreModeMemory    KeyStoreMode = "memory"
	KeyStoreModeDirectory KeyStoreMode = "directory"
	KeyStoreModeVault     KeyStoreMode = "vault"
)

type LeaderElectionConfig

type LeaderElectionConfig struct {
	Mode LeaderElectionMode       `yaml:"mode"`
	Raft LeaderElectionRaftConfig `yaml:"raft"`
}

type LeaderElectionMode

type LeaderElectionMode string
const (
	LeaderElectionModeNone LeaderElectionMode = "none"
	LeaderElectionModeRaft LeaderElectionMode = "raft"
)

type LeaderElectionRaftConfig

type LeaderElectionRaftConfig struct {
	Host        string     `yaml:"host"`
	Port        int        `yaml:"port"`
	Id          string     `yaml:"id"`
	InitiatorId string     `yaml:"initiatorId"`
	Nodes       []RaftNode `yaml:"nodes"`
}

type PostgresConfig

type PostgresConfig struct {
	Database string `yaml:"database"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	SslMode  string `yaml:"sslMode"`
}

type QueueMode

type QueueMode string

QueueMode has the following constants: DeliveryModeNoop, DeliveryModeInProcess

const (
	QueueModeNoop      QueueMode = "noop"
	QueueModeInProcess QueueMode = "in-process"
)

type RaftNode

type RaftNode struct {
	Id      string `yaml:"id"`
	Address string `yaml:"address"`
}

type ServerConfig

type ServerConfig struct {
	ExternalUrl    string   `yaml:"externalUrl"`
	ExternalDomain string   `yaml:"externalDomain"`
	Host           string   `yaml:"host"`
	Port           int      `yaml:"port"`
	ApiPort        int      `yaml:"apiPort"`
	AllowedOrigins []string `yaml:"allowedOrigins"`
}

type ServiceUserConfig added in v0.3.5

type ServiceUserConfig struct {
	Username  string   `yaml:"username"`
	Roles     []string `yaml:"roles"`
	PublicKey struct {
		Pem string `yaml:"pem"`
		Kid string `yaml:"kid"`
	} `yaml:"publicKey"`
}

type SigningAlgorithm

type SigningAlgorithm string
const (
	SigningAlgorithmRS256 SigningAlgorithm = "RS256"
	SigningAlgorithmEdDSA SigningAlgorithm = "EdDSA"
)

type VaultKeyStoreConfig

type VaultKeyStoreConfig struct {
	Address string `yaml:"address"`
	Token   string `yaml:"token"`
	Mount   string `yaml:"mount"`
	Prefix  string `yaml:"prefix,omitempty"`
}

Jump to

Keyboard shortcuts

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