Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBasePath ¶
func GetBasePath() string
Return the basic project path. Deprecated: obsolete method, use the GetDynamicPath instead.
func GetDynamicPath ¶
Returns the absolute path of the selected file/folder. The basic path is Go-Web main folder. Example: GetDynamicPath("storage/certs/tls.key")
Types ¶
type Conf ¶
type Conf struct {
Database struct {
Driver string `yaml:"driver"`
Host string `yaml:"host"`
Port int `yaml:"port"`
Database string `yaml:"database"`
User string `yaml:"user"`
Password string `yaml:"password"`
} `yaml:"database"`
Redis struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
} `yaml:"redis"`
Mongo struct {
Database string `yaml:"database"`
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
} `yaml:"mongodb"`
Elastic struct {
Hosts []string `yaml:"hosts"`
} `yaml:"elasticsearch"`
Server struct {
Name string `yaml:"name"`
Port int `yaml:"port"`
Ssl bool `yaml:"ssl"`
SslCert string `yaml:"sslcert"`
SslKey string `yaml:"sslkey"`
RunUser string `yaml:"run-user"`
RunGroup string `yaml:"run-group"`
} `yaml:"server"`
App struct {
Key string `yaml:"key"`
} `yaml:"app"`
Mail struct {
From string `yaml:"from"`
Host string `yaml:"host"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Port int `yaml:"port"`
} `yaml:"mail"`
}
This is the main configuration of Go-Web You can implement this method if wanna implement more configuration. Remember: this struct will be populated by parsing the config.yml file present into the Go-Web main directory. You've to implement both to works properly.
func Configuration ¶
func Configuration() Conf
Get configuration struct by parsing the config.yml file.
type Route ¶
type Route struct {
Path string `yaml:"path"`
Action string `yaml:"action"`
Method string `yaml:"method"`
Description string `yaml:"description"`
Middleware []string `yaml:"middleware"`
Prefix string `yaml:"prefix"`
}
Structure used to decode all route presents into routing.yml file.
type Router ¶
type Router struct {
Routes map[string]Route `yaml:"routes"`
Groups map[string]Group `yaml:"groups"`
}
Main structure of web router.
func ConfigurationWeb ¶
func ConfigurationWeb() Router
Parse router.yml file (present in Go-Web root dir) and return a Router structure. This structure will be used by the HTTP kernel to setup every routes.