add grpc server support
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const ConfigPrefix = "Http"
|
||||
const DefaultPrefix = "Http"
|
||||
|
||||
type Config struct {
|
||||
Static *string
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const DefaultPrefix = "Http"
|
||||
|
||||
func AutoLoadConfig() *Config {
|
||||
return LoadConfig("")
|
||||
}
|
||||
|
||||
func LoadConfig(file string) *Config {
|
||||
if file == "" {
|
||||
file = "config.toml"
|
||||
}
|
||||
|
||||
v := viper.NewWithOptions(viper.KeyDelimiter("_"))
|
||||
v.AutomaticEnv()
|
||||
v.SetConfigFile(file)
|
||||
if err := v.ReadInConfig(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var config Config
|
||||
if err := v.UnmarshalKey(DefaultPrefix, &config); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return &config
|
||||
}
|
||||
Reference in New Issue
Block a user