Updated imports and generate automatic environment with viper

This commit is contained in:
David J. Allen 2024-05-07 15:50:47 -06:00
parent 2b421e8af5
commit 2edcb2199e
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
2 changed files with 5 additions and 4 deletions

View file

@ -5,8 +5,8 @@ import (
"net"
"os"
magellan "github.com/bikeshack/magellan/internal"
"github.com/bikeshack/magellan/internal/api/smd"
magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/OpenCHAMI/magellan/internal/api/smd"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

View file

@ -3,7 +3,7 @@ package magellan
import (
"fmt"
"github.com/bikeshack/magellan/internal/util"
"github.com/OpenCHAMI/magellan/internal/util"
"github.com/spf13/viper"
)
@ -16,6 +16,7 @@ func LoadConfig(path string) error {
// ...no search paths set intentionally, so config has to be set explicitly
// ...also, the config file will not save anything
// ...and finally, parameters passed to CLI have precedence over config values
viper.AutomaticEnv()
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
return fmt.Errorf("config file not found: %w", err)