config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvTest  = "test"
	EnvLocal = "local"
	EnvProd  = "prod"

	DriverMysql      = "mysql"
	DriverSqlite     = "sqlite"
	DriverPostgresql = "postgresql"
	DriverMssql      = "mssql"
)

Variables

This section is empty.

Functions

func ReadFromJson added in v0.0.5

func ReadFromJson(path string)

func Set

func Set(cfg Config)

Set sets the config.

Types

type Config

type Config struct {
	// An map supports multi database connection. The first
	// element of Databases is the default connection. See the
	// file connection.go.
	Databases DatabaseList `json:"database"`

	// The cookie domain used in the auth modules. see
	// the session.go.
	Domain string `json:"domain"`

	// Used to set as the localize language which show in the
	// interface.
	Language string `json:"language"`

	// The global url prefix.
	UrlPrefix string `json:"prefix"`

	// The theme name of template.
	Theme string `json:"theme"`

	// The path where files will be stored into.
	Store Store `json:"store"`

	// The title of web page.
	Title string `json:"title"`

	Logo template.HTML `json:"logo"`

	MiniLogo template.HTML `json:"mini_logo"`

	// The url redirect to after login
	IndexUrl string `json:"index"`

	// Debug mode
	Debug bool `json:"debug"`

	// Env is the environment, which maybe local, test, prod.
	Env string

	// Info log path
	InfoLogPath string `json:"info_log"`

	// Error log path
	ErrorLogPath string `json:"error_log"`

	// Access log path
	AccessLogPath string `json:"access_log"`

	// Sql operator record log switch
	SqlLog bool `json:"sql_log"`

	AccessLogOff bool
	InfoLogOff   bool
	ErrorLogOff  bool

	// Color scheme
	ColorScheme string `json:"color_scheme"`
	// contains filtered or unexported fields
}

Config type is the global config of goAdmin. It will be initialized in the engine.

func Get

func Get() Config

Get gets the config.

func (Config) GetIndexUrl added in v0.0.5

func (c Config) GetIndexUrl() string

func (Config) Index added in v0.0.5

func (c Config) Index() string

func (Config) IsLocalEnvironment added in v0.0.14

func (c Config) IsLocalEnvironment() bool

func (Config) IsProductionEnvironment added in v0.0.14

func (c Config) IsProductionEnvironment() bool

func (Config) IsTestEnvironment added in v0.0.14

func (c Config) IsTestEnvironment() bool

func (Config) Prefix added in v0.0.5

func (c Config) Prefix() string

func (Config) PrefixFixSlash added in v0.0.5

func (c Config) PrefixFixSlash() string

func (Config) Url added in v0.0.5

func (c Config) Url(suffix string) string

func (Config) UrlRemovePrefix added in v0.0.5

func (c Config) UrlRemovePrefix(u string) string

type Database

type Database struct {
	Host       string `json:"host"`
	Port       string `json:"port"`
	User       string `json:"user"`
	Pwd        string `json:"pwd"`
	Name       string `json:"name"`
	MaxIdleCon int    `json:"max_idle_con"`
	MaxOpenCon int    `json:"max_open_con"`
	Driver     string `json:"driver"`
	File       string `json:"file"`
}

Database is a type of database connection config. Because a little difference of different database driver. The Config has multiple options but may be not used. Such as the sqlite driver only use the File option which can be ignored when the driver is mysql.

type DatabaseList added in v0.0.5

type DatabaseList map[string]Database

func (DatabaseList) Add added in v0.0.5

func (d DatabaseList) Add(key string, db Database)

func (DatabaseList) GetDefault added in v0.0.5

func (d DatabaseList) GetDefault() Database

func (DatabaseList) GroupByDriver added in v0.0.5

func (d DatabaseList) GroupByDriver() map[string]DatabaseList

type Store

type Store struct {
	Path   string
	Prefix string
}

Store is the file store config. Path is the local store path. and prefix is the url prefix used to visit it.

Jump to

Keyboard shortcuts

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