File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package config
1919
2020import (
2121 "fmt"
22+ "os"
2223
2324 "github.com/spf13/viper"
2425)
@@ -39,10 +40,24 @@ func Retrieve() (*Config, error) {
3940 v .AddConfigPath ("." )
4041 err := v .ReadInConfig ()
4142 if err != nil {
42- err = fmt .Errorf ("%s: %w" , "retrieving config file" , err )
43+ fmt .Errorf ("%s: %w" , "retrieving config file" , err )
44+ } else {
45+ v .Unmarshal (conf )
46+ }
47+
48+ client , found := os .LookupEnv ("ARDUINO_CLOUD_CLIENT" )
49+ if ! found {
50+ err = fmt .Errorf ("%s: %w" , "Unable to retrieve token client" , err )
51+ return nil , err
52+
53+ }
54+ secret , found := os .LookupEnv ("ARDUINO_CLOUD_SECRET" )
55+ if ! found {
56+ err = fmt .Errorf ("%s: %w" , "Unable to retrieve token secret" , err )
4357 return nil , err
4458 }
4559
46- v .Unmarshal (conf )
60+ conf .Client = client
61+ conf .Secret = secret
4762 return conf , nil
4863}
You can’t perform that action at this time.
0 commit comments