Documentation ¶
Index ¶
- Constants
- func AssertPrefix() string
- func GetAccessLogOff() bool
- func GetAccessLogPath() string
- func GetAllowDelOperationLog() bool
- func GetAppID() string
- func GetAssetRootPath() string
- func GetAssetUrl() string
- func GetAuthUserTable() string
- func GetColorScheme() string
- func GetCustom403HTML() template.HTML
- func GetCustom404HTML() template.HTML
- func GetCustom500HTML() template.HTML
- func GetCustomFootHtml() template.HTML
- func GetCustomHeadHtml() template.HTML
- func GetDebug() bool
- func GetDomain() string
- func GetEnv() string
- func GetErrorLogOff() bool
- func GetErrorLogPath() string
- func GetExcludeThemeComponents() []string
- func GetExtra() map[string]interface{}
- func GetFooterInfo() template.HTML
- func GetHideVisitorUserCenterEntrance() bool
- func GetIndexURL() string
- func GetIndexUrl() string
- func GetInfoLogOff() bool
- func GetInfoLogPath() string
- func GetLanguage() string
- func GetLoginLogo() template.HTML
- func GetLoginTitle() string
- func GetLoginUrl() string
- func GetLogo() template.HTML
- func GetMiniLogo() template.HTML
- func GetNoLimitLoginIP() bool
- func GetOpenAdminApi() bool
- func GetOperationLogOff() bool
- func GetSessionLifeTime() int
- func GetSiteOff() bool
- func GetSqlLog() bool
- func GetTheme() string
- func GetTitle() string
- func GetUrlPrefix() string
- func IsNotProductionEnvironment() bool
- func IsProductionEnvironment() bool
- func Prefix() string
- func PrefixFixSlash() string
- func URLRemovePrefix(url string) string
- func Url(suffix string) string
- type Config
- func (c *Config) AddUpdateProcessFn(fn UpdateConfigProcessFn) *Config
- func (c *Config) AssertPrefix() string
- func (c *Config) Copy() *Config
- func (c *Config) EraseSens() *Config
- func (c *Config) GetIndexURL() string
- func (c *Config) Index() string
- func (c *Config) IsLocalEnvironment() bool
- func (c *Config) IsNotProductionEnvironment() bool
- func (c *Config) IsProductionEnvironment() bool
- func (c *Config) IsTestEnvironment() bool
- func (c *Config) Prefix() string
- func (c *Config) PrefixFixSlash() string
- func (c *Config) ToMap() map[string]string
- func (c *Config) URLRemovePrefix(url string) string
- func (c *Config) Update(m map[string]string) error
- func (c *Config) Url(suffix string) string
- type Database
- type DatabaseList
- type EncoderCfg
- type ExtraInfo
- type FileUploadEngine
- type Logger
- type PageAnimation
- type RotateCfg
- type Service
- type Store
- type UpdateConfigProcessFn
Constants ¶
const ( // EnvTest is a const value of test environment. EnvTest = "test" // EnvLocal is a const value of local environment. EnvLocal = "local" // EnvProd is a const value of production environment. EnvProd = "prod" // DriverMysql is a const value of mysql driver. DriverMysql = "mysql" // DriverSqlite is a const value of sqlite driver. DriverSqlite = "sqlite" // DriverPostgresql is a const value of postgresql driver. DriverPostgresql = "postgresql" // DriverMssql is a const value of mssql driver. DriverMssql = "mssql" )
Variables ¶
This section is empty.
Functions ¶
func GetAccessLogOff ¶
func GetAccessLogOff() bool
func GetAccessLogPath ¶
func GetAccessLogPath() string
func GetAllowDelOperationLog ¶
func GetAllowDelOperationLog() bool
func GetAssetRootPath ¶
func GetAssetRootPath() string
func GetAssetUrl ¶
func GetAssetUrl() string
func GetAuthUserTable ¶
func GetAuthUserTable() string
func GetColorScheme ¶
func GetColorScheme() string
func GetCustom403HTML ¶
func GetCustom404HTML ¶
func GetCustom500HTML ¶
func GetCustomFootHtml ¶
func GetCustomHeadHtml ¶
func GetErrorLogOff ¶
func GetErrorLogOff() bool
func GetErrorLogPath ¶
func GetErrorLogPath() string
func GetExcludeThemeComponents ¶
func GetExcludeThemeComponents() []string
func GetFooterInfo ¶
func GetHideVisitorUserCenterEntrance ¶
func GetHideVisitorUserCenterEntrance() bool
func GetIndexUrl ¶
func GetIndexUrl() string
func GetInfoLogOff ¶
func GetInfoLogOff() bool
func GetInfoLogPath ¶
func GetInfoLogPath() string
func GetLanguage ¶
func GetLanguage() string
func GetLoginLogo ¶
func GetLoginTitle ¶
func GetLoginTitle() string
func GetLoginUrl ¶
func GetLoginUrl() string
func GetMiniLogo ¶
func GetNoLimitLoginIP ¶
func GetNoLimitLoginIP() bool
func GetOpenAdminApi ¶
func GetOpenAdminApi() bool
func GetOperationLogOff ¶
func GetOperationLogOff() bool
func GetSessionLifeTime ¶
func GetSessionLifeTime() int
func GetSiteOff ¶
func GetSiteOff() bool
func GetUrlPrefix ¶
func GetUrlPrefix() string
func IsNotProductionEnvironment ¶
func IsNotProductionEnvironment() bool
IsNotProductionEnvironment check the environment if it is not production.
func IsProductionEnvironment ¶
func IsProductionEnvironment() bool
IsProductionEnvironment check the environment if it is production.
func PrefixFixSlash ¶
func PrefixFixSlash() string
PrefixFixSlash return the prefix fix the slash error.
func URLRemovePrefix ¶
URLRemovePrefix remove prefix from the given url.
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,omitempty" yaml:"database,omitempty" ini:"database,omitempty"` // The application unique ID. Once generated, don't modify. AppID string `json:"app_id,omitempty" yaml:"app_id,omitempty" ini:"app_id,omitempty"` // The cookie domain used in the auth modules. see // the session.go. Domain string `json:"domain,omitempty" yaml:"domain,omitempty" ini:"domain,omitempty"` // Used to set as the localize language which show in the // interface. Language string `json:"language,omitempty" yaml:"language,omitempty" ini:"language,omitempty"` // The global url prefix. UrlPrefix string `json:"prefix,omitempty" yaml:"prefix,omitempty" ini:"prefix,omitempty"` // The theme name of template. Theme string `json:"theme,omitempty" yaml:"theme,omitempty" ini:"theme,omitempty"` // The path where files will be stored into. Store Store `json:"store,omitempty" yaml:"store,omitempty" ini:"store,omitempty"` // The title of web page. Title string `json:"title,omitempty" yaml:"title,omitempty" ini:"title,omitempty"` // Logo is the top text in the sidebar. Logo template.HTML `json:"logo,omitempty" yaml:"logo,omitempty" ini:"logo,omitempty"` // Mini-logo is the top text in the sidebar when folding. MiniLogo template.HTML `json:"mini_logo,omitempty" yaml:"mini_logo,omitempty" ini:"mini_logo,omitempty"` // The url redirect to after login. IndexUrl string `json:"index,omitempty" yaml:"index,omitempty" ini:"index,omitempty"` // Login page URL LoginUrl string `json:"login_url,omitempty" yaml:"login_url,omitempty" ini:"login_url,omitempty"` // Debug mode Debug bool `json:"debug,omitempty" yaml:"debug,omitempty" ini:"debug,omitempty"` // Env is the environment,which maybe local,test,prod. Env string `json:"env,omitempty" yaml:"env,omitempty" ini:"env,omitempty"` // Info log path. InfoLogPath string `json:"info_log,omitempty" yaml:"info_log,omitempty" ini:"info_log,omitempty"` // Error log path. ErrorLogPath string `json:"error_log,omitempty" yaml:"error_log,omitempty" ini:"error_log,omitempty"` // Access log path. AccessLogPath string `json:"access_log,omitempty" yaml:"access_log,omitempty" ini:"access_log,omitempty"` // Access assets log off AccessAssetsLogOff bool `json:"access_assets_log_off,omitempty" yaml:"access_assets_log_off,omitempty" ini:"access_assets_log_off,omitempty"` // Sql operator record log switch. SqlLog bool `json:"sql_log,omitempty" yaml:"sql_log,omitempty" ini:"sql_log,omitempty"` AccessLogOff bool `json:"access_log_off,omitempty" yaml:"access_log_off,omitempty" ini:"access_log_off,omitempty"` InfoLogOff bool `json:"info_log_off,omitempty" yaml:"info_log_off,omitempty" ini:"info_log_off,omitempty"` ErrorLogOff bool `json:"error_log_off,omitempty" yaml:"error_log_off,omitempty" ini:"error_log_off,omitempty"` Logger Logger `json:"logger,omitempty" yaml:"logger,omitempty" ini:"logger,omitempty"` // Color scheme. ColorScheme string `json:"color_scheme,omitempty" yaml:"color_scheme,omitempty" ini:"color_scheme,omitempty"` // Session valid time duration,units are seconds. Default 7200. SessionLifeTime int `json:"session_life_time,omitempty" yaml:"session_life_time,omitempty" ini:"session_life_time,omitempty"` // Assets visit link. AssetUrl string `json:"asset_url,omitempty" yaml:"asset_url,omitempty" ini:"asset_url,omitempty"` // File upload engine,default "local" FileUploadEngine FileUploadEngine `json:"file_upload_engine,omitempty" yaml:"file_upload_engine,omitempty" ini:"file_upload_engine,omitempty"` // Custom html in the tag head. CustomHeadHtml template.HTML `json:"custom_head_html,omitempty" yaml:"custom_head_html,omitempty" ini:"custom_head_html,omitempty"` // Custom html after body. CustomFootHtml template.HTML `json:"custom_foot_html,omitempty" yaml:"custom_foot_html,omitempty" ini:"custom_foot_html,omitempty"` FooterInfo template.HTML `json:"footer_info,omitempty" yaml:"footer_info,omitempty" ini:"footer_info,omitempty"` // Login page title LoginTitle string `json:"login_title,omitempty" yaml:"login_title,omitempty" ini:"login_title,omitempty"` // Login page logo LoginLogo template.HTML `json:"login_logo,omitempty" yaml:"login_logo,omitempty" ini:"login_logo,omitempty"` // Auth user table AuthUserTable string `json:"auth_user_table,omitempty" yaml:"auth_user_table,omitempty" ini:"auth_user_table,omitempty"` // Extra config info Extra ExtraInfo `json:"extra,omitempty" yaml:"extra,omitempty" ini:"extra,omitempty"` // Page animation Animation PageAnimation `json:"animation,omitempty" yaml:"animation,omitempty" ini:"animation,omitempty"` // Limit login with different IPs NoLimitLoginIP bool `json:"no_limit_login_ip,omitempty" yaml:"no_limit_login_ip,omitempty" ini:"no_limit_login_ip,omitempty"` // When site off is true, website will be closed SiteOff bool `json:"site_off,omitempty" yaml:"site_off,omitempty" ini:"site_off,omitempty"` // Hide config center entrance flag HideConfigCenterEntrance bool `` /* 133-byte string literal not displayed */ // Hide app info entrance flag HideAppInfoEntrance bool `json:"hide_app_info_entrance,omitempty" yaml:"hide_app_info_entrance,omitempty" ini:"hide_app_info_entrance,omitempty"` // Hide tool entrance flag HideToolEntrance bool `json:"hide_tool_entrance,omitempty" yaml:"hide_tool_entrance,omitempty" ini:"hide_tool_entrance,omitempty"` HidePluginEntrance bool `json:"hide_plugin_entrance,omitempty" yaml:"hide_plugin_entrance,omitempty" ini:"hide_plugin_entrance,omitempty"` Custom404HTML template.HTML `json:"custom_404_html,omitempty" yaml:"custom_404_html,omitempty" ini:"custom_404_html,omitempty"` Custom403HTML template.HTML `json:"custom_403_html,omitempty" yaml:"custom_403_html,omitempty" ini:"custom_403_html,omitempty"` Custom500HTML template.HTML `json:"custom_500_html,omitempty" yaml:"custom_500_html,omitempty" ini:"custom_500_html,omitempty"` // Update Process Function UpdateProcessFn UpdateConfigProcessFn `json:"-" yaml:"-" ,omitemptyini:"-,omitempty"` // Is open admin plugin json api OpenAdminApi bool `json:"open_admin_api,omitempty" yaml:"open_admin_api,omitempty" ini:"open_admin_api,omitempty"` HideVisitorUserCenterEntrance bool `` /* 151-byte string literal not displayed */ ExcludeThemeComponents []string `json:"exclude_theme_components,omitempty" yaml:"exclude_theme_components,omitempty" ini:"exclude_theme_components,omitempty"` BootstrapFilePath string `json:"bootstrap_file_path,omitempty" yaml:"bootstrap_file_path,omitempty" ini:"bootstrap_file_path,omitempty"` GoModFilePath string `json:"go_mod_file_path,omitempty" yaml:"go_mod_file_path,omitempty" ini:"go_mod_file_path,omitempty"` AllowDelOperationLog bool `json:"allow_del_operation_log,omitempty" yaml:"allow_del_operation_log,omitempty" ini:"allow_del_operation_log,omitempty"` OperationLogOff bool `json:"operation_log_off,omitempty" yaml:"operation_log_off,omitempty" ini:"operation_log_off,omitempty"` AssetRootPath string `json:"asset_root_path,omitempty" yaml:"asset_root_path,omitempty" ini:"asset_root_path,omitempty"` // contains filtered or unexported fields }
Config type is the global config of goAdmin. It will be initialized in the engine.
func GetService ¶
func GetService(s interface{}) *Config
func ReadFromINI ¶
ReadFromINI read the Config from a INI file.
func ReadFromJson ¶
ReadFromJson read the Config from a JSON file.
func ReadFromYaml ¶
ReadFromYaml read the Config from a YAML file.
func SetDefault ¶
func (*Config) AddUpdateProcessFn ¶
func (c *Config) AddUpdateProcessFn(fn UpdateConfigProcessFn) *Config
func (*Config) AssertPrefix ¶
AssertPrefix return the prefix of assert.
func (*Config) GetIndexURL ¶
GetIndexURL get the index url with prefix.
func (*Config) IsLocalEnvironment ¶
IsLocalEnvironment check the environment if it is local.
func (*Config) IsNotProductionEnvironment ¶
IsNotProductionEnvironment check the environment if it is not production.
func (*Config) IsProductionEnvironment ¶
IsProductionEnvironment check the environment if it is production.
func (*Config) IsTestEnvironment ¶
IsTestEnvironment check the environment if it is test.
func (*Config) PrefixFixSlash ¶
PrefixFixSlash return the prefix fix the slash error.
func (*Config) URLRemovePrefix ¶
URLRemovePrefix remove prefix from the given url.
type Database ¶
type Database struct { Host string `json:"host,omitempty" yaml:"host,omitempty" ini:"host,omitempty"` Port string `json:"port,omitempty" yaml:"port,omitempty" ini:"port,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty" ini:"user,omitempty"` Pwd string `json:"pwd,omitempty" yaml:"pwd,omitempty" ini:"pwd,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty" ini:"name,omitempty"` MaxIdleCon int `json:"max_idle_con,omitempty" yaml:"max_idle_con,omitempty" ini:"max_idle_con,omitempty"` MaxOpenCon int `json:"max_open_con,omitempty" yaml:"max_open_con,omitempty" ini:"max_open_con,omitempty"` Driver string `json:"driver,omitempty" yaml:"driver,omitempty" ini:"driver,omitempty"` File string `json:"file,omitempty" yaml:"file,omitempty" ini:"file,omitempty"` Dsn string `json:"dsn,omitempty" yaml:"dsn,omitempty" ini:"dsn,omitempty"` Params map[string]string `json:"params,omitempty" yaml:"params,omitempty" ini:"params,omitempty"` }
Database is a type of database connection config.
Because a little difference of different database driver. The Config has multiple options but may not be used. Such as the sqlite driver only use the File option which can be ignored when the driver is mysql.
If the Dsn is configured, when driver is mysql/postgresql/ mssql, the other configurations will be ignored, except for MaxIdleCon and MaxOpenCon.
type DatabaseList ¶
DatabaseList is a map of Database.
func GetDatabaseListFromJSON ¶
func GetDatabaseListFromJSON(m string) DatabaseList
func GetDatabases ¶
func GetDatabases() DatabaseList
func (DatabaseList) Add ¶
func (d DatabaseList) Add(key string, db Database)
Add add a Database to the DatabaseList.
func (DatabaseList) Connections ¶
func (d DatabaseList) Connections() []string
func (DatabaseList) Copy ¶
func (d DatabaseList) Copy() DatabaseList
func (DatabaseList) GetDefault ¶
func (d DatabaseList) GetDefault() Database
GetDefault get the default Database.
func (DatabaseList) GroupByDriver ¶
func (d DatabaseList) GroupByDriver() map[string]DatabaseList
GroupByDriver group the Databases with the drivers.
func (DatabaseList) JSON ¶
func (d DatabaseList) JSON() string
type EncoderCfg ¶
type EncoderCfg struct { TimeKey string `json:"time_key,omitempty" yaml:"time_key,omitempty" ini:"time_key,omitempty"` LevelKey string `json:"level_key,omitempty" yaml:"level_key,omitempty" ini:"level_key,omitempty"` NameKey string `json:"name_key,omitempty" yaml:"name_key,omitempty" ini:"name_key,omitempty"` CallerKey string `json:"caller_key,omitempty" yaml:"caller_key,omitempty" ini:"caller_key,omitempty"` MessageKey string `json:"message_key,omitempty" yaml:"message_key,omitempty" ini:"message_key,omitempty"` StacktraceKey string `json:"stacktrace_key,omitempty" yaml:"stacktrace_key,omitempty" ini:"stacktrace_key,omitempty"` Level string `json:"level,omitempty" yaml:"level,omitempty" ini:"level,omitempty"` Time string `json:"time,omitempty" yaml:"time,omitempty" ini:"time,omitempty"` Duration string `json:"duration,omitempty" yaml:"duration,omitempty" ini:"duration,omitempty"` Caller string `json:"caller,omitempty" yaml:"caller,omitempty" ini:"caller,omitempty"` Encoding string `json:"encoding,omitempty" yaml:"encoding,omitempty" ini:"encoding,omitempty"` }
type FileUploadEngine ¶
type FileUploadEngine struct { Name string `json:"name,omitempty" yaml:"name,omitempty" ini:"name,omitempty"` Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty" ini:"config,omitempty"` }
FileUploadEngine is a file upload engine.
func GetFileUploadEngine ¶
func GetFileUploadEngine() FileUploadEngine
func GetFileUploadEngineFromJSON ¶
func GetFileUploadEngineFromJSON(m string) FileUploadEngine
func (FileUploadEngine) JSON ¶
func (f FileUploadEngine) JSON() string
type Logger ¶
type Logger struct { Encoder EncoderCfg `json:"encoder,omitempty" yaml:"encoder,omitempty" ini:"encoder,omitempty"` Rotate RotateCfg `json:"rotate,omitempty" yaml:"rotate,omitempty" ini:"rotate,omitempty"` Level int8 `json:"level,omitempty" yaml:"level,omitempty" ini:"level,omitempty"` }
type PageAnimation ¶
type PageAnimation struct { Type string `json:"type,omitempty" yaml:"type,omitempty" ini:"type,omitempty"` Duration float32 `json:"duration,omitempty" yaml:"duration,omitempty" ini:"duration,omitempty"` Delay float32 `json:"delay,omitempty" yaml:"delay,omitempty" ini:"delay,omitempty"` }
see more: https://daneden.github.io/animate.css/
func GetAnimation ¶
func GetAnimation() PageAnimation
func (PageAnimation) JSON ¶
func (p PageAnimation) JSON() string
type RotateCfg ¶
type RotateCfg struct { MaxSize int `json:"max_size,omitempty" yaml:"max_size,omitempty" ini:"max_size,omitempty"` MaxBackups int `json:"max_backups,omitempty" yaml:"max_backups,omitempty" ini:"max_backups,omitempty"` MaxAge int `json:"max_age,omitempty" yaml:"max_age,omitempty" ini:"max_age,omitempty"` Compress bool `json:"compress,omitempty" yaml:"compress,omitempty" ini:"compress,omitempty"` }
type Store ¶
type Store struct { Path string `json:"path,omitempty" yaml:"path,omitempty" ini:"path,omitempty"` Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty" ini:"prefix,omitempty"` }
Store is the file store config. Path is the local store path. and prefix is the url prefix used to visit it.