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
19
19
20
20
import (
21
21
"fmt"
22
+ "os"
22
23
23
24
"github.com/spf13/viper"
24
25
)
@@ -39,10 +40,24 @@ func Retrieve() (*Config, error) {
39
40
v .AddConfigPath ("." )
40
41
err := v .ReadInConfig ()
41
42
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 )
43
57
return nil , err
44
58
}
45
59
46
- v .Unmarshal (conf )
60
+ conf .Client = client
61
+ conf .Secret = secret
47
62
return conf , nil
48
63
}
You can’t perform that action at this time.
0 commit comments