config

package
Version: v0.0.0-...-3b47b55 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	ID           string
	Name         string
	Describe     string
	Resources    []Resource
	DefaultCheck bool
	Status       int
	Deleted      int
}

type AdmissionConfig

type AdmissionConfig struct {
	CasbinModel string
	TablePrefix string
	LogMode     bool
}

AdmissionConfig represents the configuration of casbin

type Config

type Config struct {
	Addr         string
	PidFile      string
	TLSCert      string
	TLSKey       string
	LogLevel     string
	LogFormatter string
	LogFilePath  string
	Maintenance  bool
	Database     DatabaseConfig
	Admission    AdmissionConfig
	Redis        RedisConfig
	Session      SessionConfig
}

func LoadConfig

func LoadConfig(configPath string, log *logrus.Logger) (*Config, error)

Read a YAML configuration and create a Config object out of it.

type DatabaseConfig

type DatabaseConfig struct {
	Driver          string
	DSN             string
	TablePrefix     string
	AutoMigrate     bool
	LogMode         bool
	MaxIdleConns    int
	MaxOpenConns    int
	ConnMaxLifetime int
}

DatabaseConfig represents the configuration of a mysql/sqlite3/postgres database

type InitData

type InitData struct {
	Roles       []Role
	Permissions []Permission
}

func LoadInitData

func LoadInitData(dataPath string, log *logrus.Logger) (*InitData, error)

type Permission

type Permission struct {
	ID           string
	Name         string
	Label        string
	Describe     string
	Icon         string
	Path         string
	Actions      []Action
	DefaultCheck bool
	Status       int
	Deleted      int
}

type RedisConfig

type RedisConfig struct {
	Host     string
	Port     int64
	Password string
	DBIndex  int
	MaxConn  int
}

RedisConfig represents the configuration related to redis cache & session store.

type Resource

type Resource struct {
	ID       string
	ActionID uint64
	Method   string
	Path     string
}

type Role

type Role struct {
	ID       string
	Name     string
	Label    string
	Describe string
	Users    []User
}

type SessionConfig

type SessionConfig struct {
	Name       string
	Secret     string
	Expiration int64 // Expiration in seconds
	Inactivity int64 // Inactivity in seconds
	Domain     string
	Secure     bool
	KeyPrefix  string // default session
}

type User

type User struct {
	ID       string
	Username string
	Nickname string
	Password string
}

Jump to

Keyboard shortcuts

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