config

package
v5.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxUploadSize = "50M"
View Source
const DefaultRootDir = "/tmp/mars-uploads"

Variables

This section is empty.

Functions

func GetFreePort

func GetFreePort() (int, error)

Types

type Config

type Config struct {
	AppPort         string `mapstructure:"app_port"`
	GrpcPort        string `mapstructure:"grpc_port"`
	Debug           bool   `mapstructure:"debug"`
	LogChannel      string `mapstructure:"log_channel"`
	GitServerCached bool   `mapstructure:"git_server_cached"`
	CacheDriver     string `mapstructure:"cache_driver"`
	// 启动时排除这些服务,用 ',' 隔开
	ExcludeServer ExcludeServerTags `mapstructure:"exclude_server"`

	MetricsPort string `mapstructure:"metrics_port"`

	AdminPassword string `mapstructure:"admin_password"`
	PrivateKey    string `mapstructure:"private_key"  json:"-"`

	DomainManagerPlugin Plugin `mapstructure:"domain_manager_plugin"`
	WsSenderPlugin      Plugin `mapstructure:"ws_sender_plugin"`
	PicturePlugin       Plugin `mapstructure:"picture_plugin"`
	GitServerPlugin     Plugin `mapstructure:"git_server_plugin"`

	UploadDir     string `mapstructure:"upload_dir"`
	UploadMaxSize string `mapstructure:"upload_max_size"`

	S3Enabled         bool   `mapstructure:"s3_enabled"`
	S3Endpoint        string `mapstructure:"s3_endpoint"`
	S3AccessKeyID     string `mapstructure:"s3_access_key_id"`
	S3SecretAccessKey string `mapstructure:"s3_secret_access_key"`
	S3Bucket          string `mapstructure:"s3_bucket"`
	S3UseSSL          bool   `mapstructure:"s3_use_ssl"`

	KubeConfig string `mapstructure:"kubeconfig"`
	NsPrefix   string `mapstructure:"ns_prefix"`
	ExternalIp string `mapstructure:"external_ip"`

	TracingEndpoint string `mapstructure:"tracing_endpoint"`

	// mysql
	DBDriver           string        `mapstructure:"db_driver"`
	DBHost             string        `mapstructure:"db_host"`
	DBPort             string        `mapstructure:"db_port"`
	DBUsername         string        `mapstructure:"db_username"`
	DBPassword         string        `mapstructure:"db_password"`
	DBDatabase         string        `mapstructure:"db_database"`
	DBSlowLogEnabled   bool          `mapstructure:"db_slow_log_enabled"`
	DBSlowLogThreshold time.Duration `mapstructure:"db_slow_log_threshold"`
	DBDebug            bool          `mapstructure:"db_debug"`
	DBAutoMigrate      bool          `mapstructure:"db_auto_migrate"`

	ImagePullSecrets DockerAuths `mapstructure:"imagepullsecrets"`

	InstallTimeout time.Duration `mapstructure:"install_timeout" json:"-"`
	Oidc           []OidcSetting `mapstructure:"oidc"`
}

func Init

func Init(cfgFile string) *Config

func (*Config) DSN

func (c *Config) DSN() string

func (*Config) MaxUploadSize

func (c *Config) MaxUploadSize() uint64

type DockerAuth

type DockerAuth struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Email    string `mapstructure:"email"`
	Server   string `mapstructure:"server"`
}

func (DockerAuth) String

func (a DockerAuth) String() string

type DockerAuths

type DockerAuths []*DockerAuth

func (DockerAuths) FormatDockerCfg

func (a DockerAuths) FormatDockerCfg() []byte

func (DockerAuths) String

func (a DockerAuths) String() string

type DockerConfigEntry

type DockerConfigEntry struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Email    string `json:"email,omitempty"`
	Auth     string `json:"auth,omitempty"`
}

type DockerConfigJSON

type DockerConfigJSON struct {
	Auths map[string]DockerConfigEntry `json:"auths"`
}

type ExcludeServerTags

type ExcludeServerTags string

func (ExcludeServerTags) List

func (est ExcludeServerTags) List() (res []string)

type OidcSetting

type OidcSetting struct {
	Name         string `mapstructure:"name"`
	Enabled      bool   `mapstructure:"enabled"`
	ProviderUrl  string `mapstructure:"provider_url"`
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectUrl  string `mapstructure:"redirect_url"`
}

type Plugin

type Plugin struct {
	Name string         `mapstructure:"name"`
	Args map[string]any `mapstructure:"args"`
}

func (Plugin) GetArgs

func (p Plugin) GetArgs() map[string]any

func (Plugin) String

func (p Plugin) String() string

Jump to

Keyboard shortcuts

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