install

package
v0.0.0-...-883d24b Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const UIStaticPath = "build/static"

Variables

This section is empty.

Functions

func CheckConfigFile

func CheckConfigFile(ctx *gin.Context)

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

func CheckConfigFileAndRedirectToInstallPage(ctx *gin.Context)

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

func CheckDatabase(ctx *gin.Context)

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 InitBaseInfo

func InitBaseInfo(ctx *gin.Context)

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

func InitEnvironment(ctx *gin.Context)

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

func LangOptions(ctx *gin.Context)

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

func NewInstallHTTPServer() *gin.Engine

NewInstallHTTPServer new install http server.

func Run

func Run(configPath string)

func TryToInstallByEnv

func TryToInstallByEnv() (installByEnv bool, err error)

func WebPage

func WebPage(c *gin.Context)

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()

type InitEnvironmentResp

type InitEnvironmentResp struct {
	Success            bool   `json:"success"`
	CreateConfigFailed bool   `json:"create_config_failed"`
	DefaultConfig      string `json:"default_config"`
	ErrType            string `json:"err_type"`
}

InitEnvironmentResp init environment response

Jump to

Keyboard shortcuts

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