mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Updated imports and generate automatic environment with viper
This commit is contained in:
parent
2b421e8af5
commit
2edcb2199e
2 changed files with 5 additions and 4 deletions
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
magellan "github.com/bikeshack/magellan/internal"
|
magellan "github.com/OpenCHAMI/magellan/internal"
|
||||||
"github.com/bikeshack/magellan/internal/api/smd"
|
"github.com/OpenCHAMI/magellan/internal/api/smd"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package magellan
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/bikeshack/magellan/internal/util"
|
"github.com/OpenCHAMI/magellan/internal/util"
|
||||||
"github.com/spf13/viper"
|
"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
|
// ...no search paths set intentionally, so config has to be set explicitly
|
||||||
// ...also, the config file will not save anything
|
// ...also, the config file will not save anything
|
||||||
// ...and finally, parameters passed to CLI have precedence over config values
|
// ...and finally, parameters passed to CLI have precedence over config values
|
||||||
|
viper.AutomaticEnv()
|
||||||
if err := viper.ReadInConfig(); err != nil {
|
if err := viper.ReadInConfig(); err != nil {
|
||||||
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
|
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
|
||||||
return fmt.Errorf("config file not found: %w", err)
|
return fmt.Errorf("config file not found: %w", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue