* request a port when not port given * make context an interface, for easy testing (#380)
17 lines
288 B
Go
17 lines
288 B
Go
package middlewares
|
|
|
|
import (
|
|
"github.com/metrue/fx/config"
|
|
"github.com/metrue/fx/context"
|
|
)
|
|
|
|
// LoadConfig load default config
|
|
func LoadConfig(ctx context.Contexter) error {
|
|
config, err := config.LoadDefault()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
ctx.Set("config", config)
|
|
return nil
|
|
}
|