config

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDurationOr

func ParseDurationOr(s string, fallback time.Duration) time.Duration

Types

type AppConfig

type AppConfig struct {
	Name    string `json:"name" yaml:"name"`
	Env     string `json:"env" yaml:"env"`
	Version string `json:"version" yaml:"version"`
}

type Config

type Config struct {
	App         AppConfig               `json:"app" yaml:"app"`
	Server      ServerConfig            `json:"server" yaml:"server"`
	Features    FeatureConfig           `json:"features" yaml:"features"`
	Log         logx.Config             `json:"log" yaml:"log"`
	Database    db.DatabaseConfig       `json:"database" yaml:"database"`
	Redis       cache.RedisConfig       `json:"redis" yaml:"redis"`
	ObjectStore objectstore.MinIOConfig `json:"objectstore" yaml:"objectstore"`
	Casdoor     casdoor.Config          `json:"casdoor" yaml:"casdoor"`
	Metrics     metrics.Config          `json:"metrics" yaml:"metrics"`
	Session     session.Config          `json:"session" yaml:"session"`
	Health      HealthConfig            `json:"health" yaml:"health"`
	Shutdown    ShutdownConfig          `json:"shutdown" yaml:"shutdown"`
}

func Default

func Default() *Config

func Load

func Load(paths ...string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type EndpointConfig

type EndpointConfig struct {
	Addr    string `json:"addr" yaml:"addr"`
	Timeout string `json:"timeout" yaml:"timeout"`
}

type FeatureConfig

type FeatureConfig struct {
	DB      bool `json:"db" yaml:"db"`
	Cache   bool `json:"cache" yaml:"cache"`
	S3      bool `json:"s3" yaml:"s3"`
	Authn   bool `json:"authn" yaml:"authn"`
	Authz   bool `json:"authz" yaml:"authz"`
	Audit   bool `json:"audit" yaml:"audit"`
	Metrics bool `json:"metrics" yaml:"metrics"`
	Tracing bool `json:"tracing" yaml:"tracing"`
	Session bool `json:"session" yaml:"session"`
	// Permission enables Casdoor/Casbin policy management through permission.Manager.
	Permission bool `json:"permission" yaml:"permission"`
	// Sharing is deprecated. Sharing/ACL must be represented as Casdoor/Casbin policies via Permission.
	Sharing bool `json:"sharing" yaml:"sharing"`
}

type HealthConfig

type HealthConfig struct {
	Timeout string `json:"timeout" yaml:"timeout"`
}

type ServerConfig

type ServerConfig struct {
	HTTP EndpointConfig `json:"http" yaml:"http"`
	GRPC EndpointConfig `json:"grpc" yaml:"grpc"`
}

type ShutdownConfig

type ShutdownConfig struct {
	Timeout string `json:"timeout" yaml:"timeout"`
}

Jump to

Keyboard shortcuts

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