config

package
v0.0.0-...-8a57dd0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigExists

func ConfigExists(basePath string) bool

func WriteGlobalConfig

func WriteGlobalConfig(cfg *GlobalConfig) error

func WriteWorkspaceConfig

func WriteWorkspaceConfig(basePath string, cfg *WorkspaceConfig) error

Types

type DeploymentConfig

type DeploymentConfig struct {
	Key         string `toml:"key" validate:"required,ascii"`
	Name        string `toml:"name" validate:"required"`
	Description string `toml:"description" validate:"required"`
}

type FullConfig

type FullConfig struct {
	Global     *GlobalConfig     `toml:"global,omitempty"`
	Server     *ServerConfig     `toml:"server,omitempty"`
	Deployment *DeploymentConfig `toml:"deployment,omitempty"`
	Module     *ModuleConfig     `toml:"module,omitempty"`
}

func LoadFullConfig

func LoadFullConfig(basePath string) (*FullConfig, error)

func (*FullConfig) Validate

func (cfg *FullConfig) Validate() error

type GlobalConfig

type GlobalConfig struct {
	Sessions []*GlobalSessionConfig `toml:"sessions" validate:"dive"`
}

func LoadGlobalConfig

func LoadGlobalConfig() (*GlobalConfig, error)

func (*GlobalConfig) GetSessionForServer

func (cfg *GlobalConfig) GetSessionForServer(server string) *GlobalSessionConfig

func (*GlobalConfig) Validate

func (cfg *GlobalConfig) Validate() error

type GlobalSessionConfig

type GlobalSessionConfig struct {
	Server string `toml:"server" validate:"required"`
	Token  string `toml:"token" validate:"required"`
}

type ModuleBuildConfig

type ModuleBuildConfig struct {
	In  string `toml:"in"`
	Out string `toml:"out" validate:"required"`
}

type ModuleConfig

type ModuleConfig struct {
	Type  string             `toml:"type" validate:"required,oneof=go rust js"`
	Build *ModuleBuildConfig `toml:"build" validate:"required"`
}

type ServerAppConfig

type ServerAppConfig struct {
	PublicURL string `toml:"public_url" validate:"required"`
}

func (*ServerAppConfig) AuthCallbackURL

func (cfg *ServerAppConfig) AuthCallbackURL() string

type ServerConfig

type ServerConfig struct {
	Host      string               `toml:"host" validate:"required"`
	Port      int                  `toml:"port" validate:"required"`
	Log       ServerLogConfig      `toml:"log"`
	PublicURL string               `toml:"public_url" validate:"required"`
	App       ServerAppConfig      `toml:"app" validate:"required"`
	Postgres  ServerPostgresConfig `toml:"postgres" validate:"required"`
	Discord   ServerDiscordConfig  `toml:"discord" validate:"required"`
	Engine    ServerEngineConfig   `toml:"engine" validate:"required"`
}

func LoadServerConfig

func LoadServerConfig(basePath string) (*ServerConfig, error)

func (*ServerConfig) AuthCLICallbackURL

func (cfg *ServerConfig) AuthCLICallbackURL() string

func (*ServerConfig) AuthCallbackURL

func (cfg *ServerConfig) AuthCallbackURL() string

func (*ServerConfig) Validate

func (cfg *ServerConfig) Validate() error

type ServerDiscordConfig

type ServerDiscordConfig struct {
	Token        string `toml:"token" validate:"required"`
	ClientID     string `toml:"client_id" validate:"required"`
	ClientSecret string `toml:"client_secret" validate:"required"`
}

type ServerEngineConfig

type ServerEngineConfig struct {
	Limits ServerEngineLimitConfig `toml:"limits" validate:"required"`
}

type ServerEngineLimitConfig

type ServerEngineLimitConfig struct {
	MaxTotalTime           int `toml:"max_total_time" validate:"required"`
	MaxExecutionTime       int `toml:"max_execution_time" validate:"required"`
	MaxMemoryPages         int `toml:"max_memory_pages" validate:"required"`
	MaxHostCalls           int `toml:"max_host_calls" validate:"required"`
	DeploymentPoolMaxTotal int `toml:"deployment_pool_max_total" validate:"required"`
	DeploymentPoolMaxIdle  int `toml:"deployment_pool_max_idle" validate:"required"`
	DeploymentPoolMinIdle  int `toml:"deployment_pool_min_idle"`
}

type ServerLogConfig

type ServerLogConfig struct {
	Filename   string `toml:"filename"`
	MaxSize    int    `toml:"max_size"`
	MaxAge     int    `toml:"max_age"`
	MaxBackups int    `toml:"max_backups"`
}

type ServerPostgresConfig

type ServerPostgresConfig struct {
	Host     string `toml:"host" validate:"required"`
	Port     int    `toml:"port" validate:"required"`
	DBName   string `toml:"db_name" validate:"required"`
	User     string `toml:"user" validate:"required"`
	Password string `toml:"password"`
}

type WorkspaceConfig

type WorkspaceConfig struct {
	Deployment *DeploymentConfig `toml:"deployment" validate:"required"`
	Module     *ModuleConfig     `toml:"module" validate:"required"`
}

func DefaultWorkspaceConifg

func DefaultWorkspaceConifg() (*WorkspaceConfig, error)

func LoadworkspaceConfig

func LoadworkspaceConfig(basePath string) (*WorkspaceConfig, error)

func (*WorkspaceConfig) Validate

func (cfg *WorkspaceConfig) Validate() error

Jump to

Keyboard shortcuts

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