config

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const RedisCaptchaPrefix = "CAPTCHA:"

RedisCaptchaPrefix is the prefix of captcha key in redis

View Source
const RedisCasbinChannel = "/casbin"

RedisCasbinChannel is the channel of captcha key in redis

View Source
const RedisTokenPrefix = "BLACKLIST:TOKEN:"

RedisTokenPrefix is the prefix of blacklist token key in redis

Variables

This section is empty.

Functions

This section is empty.

Types

type CROSConf

type CROSConf struct {
	Address string `json:",env=CROS_ADDRESS"`
}

CROSConf stores the configuration for cross domain

type DatabaseConf

type DatabaseConf struct {
	Host         string `json:",env=DATABASE_HOST"`
	Port         int    `json:",env=DATABASE_PORT"`
	Username     string `json:",default=root,env=DATABASE_USERNAME"`
	Password     string `json:",optional,env=DATABASE_PASSWORD"`
	DBName       string `json:",default=simple_admin,env=DATABASE_DBNAME"`
	SSLMode      string `json:",optional,env=DATABASE_SSL_MODE"`
	Type         string `json:",default=mysql,options=[mysql,postgres,sqlite3],env=DATABASE_TYPE"`
	MaxOpenConn  int    `json:",optional,default=100,env=DATABASE_MAX_OPEN_CONN"`
	CacheTime    int    `json:",optional,default=10,env=DATABASE_CACHE_TIME"`
	DBPath       string `json:",optional,env=DATABASE_DBPATH"`
	MysqlConfig  string `json:",optional,env=DATABASE_MYSQL_CONFIG"`
	PGConfig     string `json:",optional,env=DATABASE_PG_CONFIG"`
	SqliteConfig string `json:",optional,env=DATABASE_SQLITE_CONFIG"`
}

DatabaseConf stores database configurations.

func (DatabaseConf) GetDSN

func (c DatabaseConf) GetDSN() string

GetDSN returns DSN according to the database type.

func (DatabaseConf) MysqlDSN

func (c DatabaseConf) MysqlDSN() string

MysqlDSN returns mysql DSN.

func (DatabaseConf) NewNoCacheDriver

func (c DatabaseConf) NewNoCacheDriver() *entsql.Driver

NewNoCacheDriver returns an Ent driver without cache.

func (DatabaseConf) PostgresDSN

func (c DatabaseConf) PostgresDSN() string

PostgresDSN returns Postgres DSN.

func (DatabaseConf) SqliteDSN

func (c DatabaseConf) SqliteDSN() string

SqliteDSN returns Sqlite DSN.

type RedisConf

type RedisConf struct {
	Host     string `json:",env=REDIS_HOST"`
	Db       int    `json:",default=0,env=REDIS_DB"`
	Username string `json:",optional,env=REDIS_USERNAME"`
	Pass     string `json:",optional,env=REDIS_PASSWORD"`
	Tls      bool   `json:",optional,env=REDIS_TLS"`
	Master   string `json:",optional,env=REDIS_MASTER"`
}

A RedisConf is a redis config.

func (RedisConf) MustNewUniversalRedis

func (r RedisConf) MustNewUniversalRedis() redis.UniversalClient

func (RedisConf) NewUniversalRedis

func (r RedisConf) NewUniversalRedis() (redis.UniversalClient, error)

func (RedisConf) Validate

func (r RedisConf) Validate() error

Jump to

Keyboard shortcuts

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