stupid viper...

This commit is contained in:
Niko Storni 2025-05-14 00:58:37 +02:00
parent ddd23f9a36
commit b098aa2dc8
4 changed files with 8 additions and 8 deletions

View file

@ -28,13 +28,13 @@ func init() {
}
func blobcacheCmd(cmd *cobra.Command, args []string) {
store, err := config.LoadStores(conf, "blobcache.yaml")
store, err := config.LoadStores(conf, "blobcache")
if err != nil {
log.Fatal(err)
}
defer store.Shutdown()
servers, err := config.LoadServers(store, conf, "blobcache.yaml")
servers, err := config.LoadServers(store, conf, "blobcache")
if err != nil {
log.Fatal(err)
}

View file

@ -39,13 +39,13 @@ func init() {
}
func reflector2Cmd(cmd *cobra.Command, args []string) {
store, err := config.LoadStores(conf, "reflector.yaml")
store, err := config.LoadStores(conf, "reflector")
if err != nil {
log.Fatal(err)
}
defer store.Shutdown()
servers, err := config.LoadServers(store, conf, "reflector.yaml")
servers, err := config.LoadServers(store, conf, "reflector")
if err != nil {
log.Fatal(err)
}

View file

@ -31,13 +31,13 @@ func init() {
}
func uploadCmd(cmd *cobra.Command, args []string) {
store, err := config.LoadStores(conf, "upload.yaml")
store, err := config.LoadStores(conf, "upload")
if err != nil {
log.Fatal(err)
}
defer store.Shutdown()
databaseConn, err := config.LoadDatabase(conf, "upload.yaml")
databaseConn, err := config.LoadDatabase(conf, "upload")
if err != nil {
log.Fatal(err)
}

View file

@ -46,7 +46,7 @@ func LoadStores(path, file string) (store.BlobStore, error) {
func LoadServers(store store.BlobStore, path, file string) ([]server.BlobServer, error) {
v := viper.New()
v.AddConfigPath(path)
v.SetConfigName(file)
v.SetConfigFile(file)
err := v.ReadInConfig()
if err != nil {
return nil, errors.Err(err)
@ -77,7 +77,7 @@ func LoadServers(store store.BlobStore, path, file string) ([]server.BlobServer,
func LoadDatabase(path, file string) (*db.SQL, error) {
v := viper.New()
v.AddConfigPath(path)
v.SetConfigName(file)
v.SetConfigFile(file)
err := v.ReadInConfig()
if err != nil {
return nil, errors.Err(err)