Add configuration (#34)

This commit is contained in:
Wenbo Han
2023-02-17 23:06:44 +08:00
committed by GitHub
parent 5dfe3e988f
commit aa19e1cb07
2 changed files with 26 additions and 1 deletions

25
config/route.go Normal file
View File

@@ -0,0 +1,25 @@
package config
import (
"github.com/goravel/framework/facades"
)
func init() {
config := facades.Config
config.Add("route", map[string]any{
// HTTP Host
"host": config.Env("APP_HOST", "127.0.0.1:3000"),
// HTTPS Configuration
"tls": map[string]any{
// HTTPS Host
"host": config.Env("APP_HOST", "127.0.0.1:3000"),
// SSL Certificate
"ssl": map[string]any{
// ca.pem
"cert": "",
// ca.key
"key": "",
},
},
})
}

View File

@@ -12,7 +12,7 @@ func main() {
// Start http server by facades.Route.
go func() {
if err := facades.Route.Run(facades.Config.GetString("app.host")); err != nil {
if err := facades.Route.Run(); err != nil {
facades.Log.Errorf("Route run error: %v", err)
}
}()