config

package
v0.0.0-...-7269fc0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Enabled   bool      `json:"enabled" yaml:"enabled" env:"RC_AUTH_ENABLED" env-default:"false" description:"Enable authentication"`
	BasicAuth BasicAuth `json:"basicAuth" yaml:"basicAuth" description:"Basic authentication configuration"`
}

type BasicAuth

type BasicAuth struct {
	Enabled     bool         `json:"enabled" yaml:"enabled" env:"RC_AUTH_ENABLED" env-default:"false" description:"Enable basic authentication"`
	Credentials []Credential `json:"credentials" yaml:"credentials" description:"List of credentials for basic authentication"`
	Realm       string       `json:"realm" yaml:"realm" env:"RC_AUTH_REALM" env-default:"RestClone" description:"Basic authentication realm"`
}

type Credential

type Credential struct {
	Username string `json:"username" yaml:"username" env:"RC_BASIC_USER" description:"Username for basic authentication"`
	Password string `json:"password" yaml:"password" env:"RC_BASIC_PASS" description:"Password for basic authentication"`
}

type Server

type Server struct {
	Listen    string `json:"listen" yaml:"listen" env:"RC_LISTEN" env-default:":8080" description:"Server listen address"`
	ListenTLS string `json:"listenTls" yaml:"listenTls" env:"RC_LISTEN_TLS" env-default:":8443" description:"Server TLS listen address"`

	TLS  Tls  `json:"tls" yaml:"tls" description:"TLS configuration"`
	Auth Auth `json:"auth" yaml:"auth" description:"Authentication configuration"`

	Timeout int `json:"timeout" yaml:"timeout" env:"RC_TIMEOUT" env-default:"30" description:"Server timeout in seconds"`

	ExtraEnv map[string]string `description:"Extra environment variables"`
	// contains filtered or unexported fields
}

func Init

func Init() (*Server, error)

func (*Server) Load

func (s *Server) Load() error

Load configuration from environment variables, files, etc. Priority order: ENV > YAML/JSON > DEFAULT

func (*Server) Printf

func (s *Server) Printf(format string, logs ...any)

func (*Server) Println

func (s *Server) Println(logs ...any)

type Tls

type Tls struct {
	SelfsignedHostname string `json:"hostname" yaml:"hostname" env:"RC_HOSTNAME" description:"Server hostname"`

	TLSCertFile string `json:"certFile" yaml:"certFile" env:"RC_TLS_CERT_FILE" description:"Path to the TLS certificate file"`
	TLSKeyFile  string `json:"keyFile" yaml:"keyFile" env:"RC_TLS_KEY_FILE" description:"Path to the TLS key file"`
	TLSCAFile   string `json:"caFile" yaml:"caFile" env:"RC_TLS_CA_FILE" description:"Path to the TLS CA file"`

	TLSCert string `json:"tlsCert" yaml:"tlsCert" env:"RC_TLS_CERT" description:"TLS certificate"`
	TLSKey  string `json:"tlsKey" yaml:"tlsKey" env:"RC_TLS_KEY" description:"TLS key"`
	TLSCA   string `json:"tlsCa" yaml:"tlsCa" env:"RC_TLS_CA" description:"TLS CA"`
}

func (*Tls) GetTLSConfig

func (s *Tls) GetTLSConfig() (*tls.Config, error)

Jump to

Keyboard shortcuts

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