frontend and backend base setup
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DatabaseURL string
|
||||
Port string
|
||||
}
|
||||
|
||||
func LoadConfig(path string) (*Config, error) {
|
||||
viper.AddConfigPath(path)
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Config{
|
||||
DatabaseURL: viper.GetString("database.url"),
|
||||
Port: viper.GetString("server.port"),
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user