config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken() string

func GetConfigPath

func GetConfigPath() string

func Init

func Init(configFile string, fs ...func()) error

func InitConfig

func InitConfig(configFile string) error

func InitConfigByCode

func InitConfigByCode() error

func SaveAccess

func SaveAccess(a Access) error

func SaveCredential

func SaveCredential(c Credential) error

func Set

func Set(conf *Config)

func Show

func Show(hiddenFields ...string) string

Types

type Access

type Access struct {
	AccessToken      string `yaml:"accessToken" json:"accessToken"`
	ExpiresIn        int    `yaml:"expiresIn" json:"expiresIn"`
	RefreshTimestamp int    `yaml:"refreshTimestamp" json:"refreshTimestamp"`
	RefreshToken     string `yaml:"refreshToken" json:"refreshToken"`
}

func (*Access) IsExpired

func (a *Access) IsExpired() bool

func (*Access) IsNil

func (a *Access) IsNil() bool

type App

type App struct {
	Name  string `yaml:"name" json:"name"`
	Scope string `yaml:"scope" json:"scope"`
}

type Config

type Config struct {
	Access     Access     `yaml:"access" json:"access"`
	App        App        `yaml:"app" json:"app"`
	Credential Credential `yaml:"credential" json:"credential"`
	Database   Database   `yaml:"database" json:"database"`
	Logger     Logger     `yaml:"logger" json:"logger"`
}

func Get

func Get() *Config

type Credential

type Credential struct {
	AppID     int    `yaml:"appId" json:"appId"`
	AppKey    string `yaml:"appKey" json:"appKey"`
	SecretKey string `yaml:"secretKey" json:"secretKey"`
	SignKey   string `yaml:"signKey" json:"signKey"`
}

func (*Credential) IsNil

func (c *Credential) IsNil() bool

type Credentials

type Credentials []Credential

type Database

type Database struct {
	Driver string `yaml:"driver" json:"driver"`
	Sqlite Sqlite `yaml:"sqlite" json:"sqlite"`
}

type LogFileConfig

type LogFileConfig struct {
	Filename string `yaml:"filename" json:"filename"`
}

type Logger

type Logger struct {
	Format        string        `yaml:"format" json:"format"`
	IsSave        bool          `yaml:"isSave" json:"isSave"`
	Level         string        `yaml:"level" json:"level"`
	LogFileConfig LogFileConfig `yaml:"logFileConfig" json:"logFileConfig"`
}

type Sqlite

type Sqlite struct {
	ConnMaxLifetime int    `yaml:"connMaxLifetime" json:"connMaxLifetime"`
	DBFile          string `yaml:"dbFile" json:"dbFile"`
	EnableLog       bool   `yaml:"enableLog" json:"enableLog"`
	MaxIdleConns    int    `yaml:"maxIdleConns" json:"maxIdleConns"`
	MaxOpenConns    int    `yaml:"maxOpenConns" json:"maxOpenConns"`
}

Jump to

Keyboard shortcuts

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