File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 17
17
# pylint: disable=line-too-long,method-hidden
18
18
19
19
import json
20
+ import os
20
21
import uuid
21
22
import requests
22
23
from mbed_cloud import AccountManagementAPI
@@ -49,8 +50,15 @@ def __init__(self, **kwargs):
49
50
self .notified_value = ""
50
51
51
52
def setup (self ):
53
+ # Check if API key is in environmental vars
54
+ if os .environ ['MBED_CLOUD_SDK_API_KEY' ]:
55
+ api_key = (os .environ [str ('MBED_CLOUD_SDK_API_KEY' )])
56
+ print ("Reading api-key from environtment %" , api_key )
57
+ else :
58
+ api_key = self .config .get ("api_key" )
59
+ print ("Reading api-key from config %" , api_key )
60
+
52
61
self .device_id = self .config .get ("device_id" )
53
- api_key = self .config .get ("api_key" )
54
62
host = self .config .get ("host" )
55
63
self .test_config = {"api_key" : api_key , "host" : host }
56
64
self .account_api = AccountManagementAPI (self .test_config )
You can’t perform that action at this time.
0 commit comments