File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -40,19 +40,24 @@ func (l *Local) InitLocalProxyConfig() error {
4040
4141func (l * Local ) InitLocalConfig () error {
4242 if err := l .InitLocalProxyConfig (); err != nil {
43+ panic (err )
4344 return err
4445 }
4546
4647 type Tmp struct {
4748 Local * config.Config `json:"local"`
4849 }
4950 localConfig := & Tmp {}
50- d , e := os .ReadFile (viper .ConfigFileUsed ())
51+ configFile := viper .ConfigFileUsed ()
52+ if configFile == "" {
53+ return errors .New ("config file needed for local configuration, see https://www.signadot.com/docs/getting-started/installation/signadot-cli" )
54+ }
55+ d , e := os .ReadFile (configFile )
5156 if e != nil {
52- return e
57+ return fmt . Errorf ( "error reading config file %q: %w" , configFile , e )
5358 }
5459 if e := yaml .Unmarshal (d , localConfig ); e != nil {
55- return e
60+ return fmt . Errorf ( "error unmarshalling config file %q: %w" , configFile , e )
5661 }
5762 if localConfig .Local == nil {
5863 return fmt .Errorf ("no local section in %s" , viper .ConfigFileUsed ())
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ func (ld *LocalDaemon) InitLocalDaemon() error {
4141 if ld .ConnectInvocationConfigFile != "" {
4242 ciBytes , err = os .ReadFile (ld .ConnectInvocationConfigFile )
4343 if err != nil {
44- return err
44+ return fmt . Errorf ( "error reading connect invocation config file %q: %w" , ld . ConnectInvocationConfigFile , err )
4545 }
4646 } else {
4747 ciBytes = []byte (os .Getenv ("SIGNADOT_LOCAL_CONNECT_INVOCATION_CONFIG" ))
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import (
1717func GetSignadotDir () (string , error ) {
1818 homeDir , err := os .UserHomeDir ()
1919 if err != nil {
20- return "" , err
20+ return "" , fmt . Errorf ( "error getting user home dir: %w" , err )
2121 }
2222 return filepath .Join (homeDir , ".signadot" ), nil
2323}
@@ -76,7 +76,10 @@ func OpenBrowser(url string) error {
7676 default : // "linux", "freebsd", "openbsd", "netbsd"
7777 cmd = exec .Command ("xdg-open" , url )
7878 }
79- return cmd .Start ()
79+ if err := cmd .Start (); err != nil {
80+ return fmt .Errorf ("unable to open url %q: %w" , url , err )
81+ }
82+ return nil
8083}
8184
8285func GetSandboxesDir () (string , error ) {
You can’t perform that action at this time.
0 commit comments