conf

package
v0.0.0-...-378a548 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = Config{
	Etcd: config.Etcd{
		Endpoints: []string{
			"127.0.0.1:2379",
		},
	},
	Redis: Redis{
		DSN: "redis://:admin123@redis:6379/0?protocol=3",
	},
	MySQL: MySQL{
		DSN:     "admin:admin123@tcp(127.0.0.1:3306)/king_auth?charset=utf8mb4&parseTime=true&loc=Local",
		MinOpen: 3,
		MaxOpen: 10,
	},
	Otel: config.Opentrace{
		Enable: true,
		DSN:    "otel-collector:4317",
	},
	Log: config.Log{
		DisableTimestamp: false,
		Level:            "info",
		Format:           "json",
		MaxSize:          100,
		MaxDays:          180,
		MaxBackups:       90,
		Compress:         true,
	},
	Server: config.Server{
		Host: "0.0.0.0",
		Port: 5277,
	},
	Global: Global{
		AccessTokenExpiresIn:  10 * time.Minute,
		RefreshTokenExpiresIn: 120 * time.Minute,

		TokenLimitPerAccount: 10,
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Redis Redis `json:"redis" toml:"redis"`
	MySQL MySQL `json:"mysql" toml:"mysql"`

	Etcd   config.Etcd      `json:"etcd" toml:"etcd"`
	Log    config.Log       `json:"log" toml:"log"`
	Server config.Server    `json:"server" toml:"server"`
	Otel   config.Opentrace `json:"otel" toml:"otel"`

	Global Global `json:"global" toml:"global"`
}

func (*Config) LoadFile

func (c *Config) LoadFile(path string) error

func (*Config) String

func (c *Config) String() string

type Global

type Global struct {
	AccessTokenExpiresIn  time.Duration `json:"access-token-expires-in" toml:"access-token-expires-in"`
	RefreshTokenExpiresIn time.Duration `json:"refresh-token-expires-in" toml:"refresh-token-expires-in"`

	TokenLimitPerAccount int64 `json:"token-limit-per-account" toml:"token-limit-per-account"`
}

type MySQL

type MySQL struct {
	DSN     string `json:"dsn" toml:"dsn"`
	MinOpen int    `json:"min-open" toml:"min-open"`
	MaxOpen int    `json:"max-open" toml:"max-open"`
}

type Redis

type Redis struct {
	DSN string `json:"dsn" toml:"dsn"`
}

Jump to

Keyboard shortcuts

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