Documentation ¶
Index ¶
- Constants
- func CheckConfigFile(ctx *gin.Context)
- func CheckConfigFileAndRedirectToInstallPage(ctx *gin.Context)
- func CheckDatabase(ctx *gin.Context)
- func GetLangMapping(ctx *gin.Context)
- func InitBaseInfo(ctx *gin.Context)
- func InitEnvironment(ctx *gin.Context)
- func LangOptions(ctx *gin.Context)
- func NewInstallHTTPServer() *gin.Engine
- func Run(configPath string)
- func TryToInstallByEnv() (installByEnv bool, err error)
- func WebPage(c *gin.Context)
- type CheckConfigFileResp
- type CheckDatabaseReq
- type CheckDatabaseResp
- type Env
- type InitBaseInfoReq
- type InitEnvironmentResp
Constants ¶
const UIStaticPath = "build/static"
Variables ¶
This section is empty.
Functions ¶
func CheckConfigFile ¶
CheckConfigFile check config file if exist when installation @Summary check config file if exist when installation @Description check config file if exist when installation @Tags installation @Accept json @Produce json @Success 200 {object} handler.RespBody{data=install.CheckConfigFileResp{}} @Router /installation/config-file/check [post]
func CheckConfigFileAndRedirectToInstallPage ¶
CheckConfigFileAndRedirectToInstallPage if config file not exist try to redirect to install page @Summary if config file not exist try to redirect to install page @Description if config file not exist try to redirect to install page @Tags installation @Accept json @Produce json @Router / [get]
func CheckDatabase ¶
CheckDatabase check database if exist when installation @Summary check database if exist when installation @Description check database if exist when installation @Tags installation @Accept json @Produce json @Param data body install.CheckDatabaseReq true "CheckDatabaseReq" @Success 200 {object} handler.RespBody{data=install.CheckConfigFileResp{}} @Router /installation/db/check [post]
func GetLangMapping ¶ added in v1.4.1
GetLangMapping get installation language config mapping @Summary get installation language config mapping @Description get installation language config mapping @Tags Lang @Param lang query string true "installation language" @Produce json @Success 200 {object} handler.RespBody{} @Router /installation/language/config [get]
func InitBaseInfo ¶
InitBaseInfo init base info @Summary init base info @Description init base info @Tags installation @Accept json @Produce json @Param data body install.InitBaseInfoReq true "InitBaseInfoReq" @Success 200 {object} handler.RespBody{} @Router /installation/base-info [post]
func InitEnvironment ¶
InitEnvironment init environment @Summary init environment @Description init environment @Tags installation @Accept json @Produce json @Param data body install.CheckDatabaseReq true "CheckDatabaseReq" @Success 200 {object} handler.RespBody{} @Router /installation/init [post]
func LangOptions ¶
LangOptions get installation language options @Summary get installation language options @Description get installation language options @Tags Lang @Produce json @Success 200 {object} handler.RespBody{data=[]translator.LangOption} @Router /installation/language/options [get]
func NewInstallHTTPServer ¶
NewInstallHTTPServer new install http server.
func TryToInstallByEnv ¶
Types ¶
type CheckConfigFileResp ¶
type CheckConfigFileResp struct { ConfigFileExist bool `json:"config_file_exist"` DBConnectionSuccess bool `json:"db_connection_success"` DbTableExist bool `json:"db_table_exist"` }
CheckConfigFileResp check config file if exist or not response
type CheckDatabaseReq ¶
type CheckDatabaseReq struct { DbType string `validate:"required,oneof=postgres sqlite3 mysql" json:"db_type"` DbUsername string `json:"db_username"` DbPassword string `json:"db_password"` DbHost string `json:"db_host"` DbName string `json:"db_name"` DbFile string `json:"db_file"` }
CheckDatabaseReq check database
func (*CheckDatabaseReq) GetConnection ¶
func (r *CheckDatabaseReq) GetConnection() string
GetConnection get connection string
type CheckDatabaseResp ¶
type CheckDatabaseResp struct {
ConnectionSuccess bool `json:"connection_success"`
}
CheckDatabaseResp check database response
type Env ¶
type Env struct { AutoInstall string `json:"auto_install"` DbType string `json:"db_type"` DbUsername string `json:"db_username"` DbPassword string `json:"db_password"` DbHost string `json:"db_host"` DbName string `json:"db_name"` DbFile string `json:"db_file"` Language string `json:"lang"` SiteName string `json:"site_name"` SiteURL string `json:"site_url"` ContactEmail string `json:"contact_email"` AdminName string `json:"name"` AdminPassword string `json:"password"` AdminEmail string `json:"email"` LoginRequired bool `json:"login_required"` }
type InitBaseInfoReq ¶
type InitBaseInfoReq struct { Language string `validate:"required,gt=0,lte=30" json:"lang"` SiteName string `validate:"required,sanitizer,gt=0,lte=30" json:"site_name"` SiteURL string `validate:"required,gt=0,lte=512,url" json:"site_url"` ContactEmail string `validate:"required,email,gt=0,lte=500" json:"contact_email"` AdminName string `validate:"required,gt=3,lte=30" json:"name"` AdminPassword string `validate:"required,gte=8,lte=32" json:"password"` AdminEmail string `validate:"required,email,gt=0,lte=500" json:"email"` LoginRequired bool `json:"login_required"` }
InitBaseInfoReq init base info request
func (*InitBaseInfoReq) Check ¶
func (r *InitBaseInfoReq) Check() (errFields []*validator.FormErrorField, err error)
func (*InitBaseInfoReq) FormatSiteUrl ¶
func (r *InitBaseInfoReq) FormatSiteUrl()