config

package
v0.0.0-...-efbf809 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 9 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 {
	JWT          *JWT
	GoogleOAuth2 *pkgConfig.GoogleOAuth2
}

type Config

type Config struct {
	StoreMode  Mode
	StoreMySQL *MySQL
	StoreMongo *Mongo
	Cors       *Cors
	Auth       *Auth
	Oas        *Oas
}

func New

func New() *Config

type Cors

type Cors struct {
	AllowOrigins []string `yaml:"allowOrigins"`
}

type JWT

type JWT struct {
	Secret        string                                          `yaml:"secret"`
	Provider      func(r *http.Request) (string, []string, error) `yaml:"provider"`
	ExpirationSec int                                             `yaml:"expirationSec"`
}

type Mode

type Mode string
const (
	StoreModeMongo Mode = "mongo"
	StoreModeMySQL Mode = "mysql"
)

type Mongo

type Mongo struct {
	URI                   string
	User                  string
	Password              string
	VironDB               string
	CasbinCollectionName  string
	CasbinLoadIntervalSec *int64
}

type MySQL

type MySQL struct {
	Dialect               string
	User                  string `yaml:"user"`
	Password              string `yaml:"password"`
	Net                   string `yaml:"net"`
	Host                  string `yaml:"host"`
	Port                  int    `yaml:"port"`
	DBName                string `yaml:"dbname"`
	TLSConfig             string `yaml:"tls"`
	AllowNativePasswords  bool   `yaml:"native_password"`
	ParseTime             bool   `yaml:"parse_time"`
	CasbinLoadIntervalSec *int64 `yaml:"casbin_load_interval_sec"`
}

func (*MySQL) ToDriverConfig

func (m *MySQL) ToDriverConfig() *mysql.Config

type Oas

type Oas struct {
	InfoExtensions map[string]interface{} `json:"infoExtensions"`
}

type Store

type Store struct {
	Mode string
	*MySQL
	*Mongo
	options.ClientOptions
}

Jump to

Keyboard shortcuts

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