@@ -19,10 +19,11 @@ def config_file_path(service, tenant):
19
19
filename = '%sConfig.json' % service
20
20
return safe_join (config_path , tenant , filename )
21
21
22
- def __init__ (self , service , logger ):
22
+ def __init__ (self , service , logger , config_file_is_optional = true ):
23
23
self .service = service
24
24
self .logger = logger
25
25
self .config = None
26
+ self .config_file_is_optional = config_file_is_optional
26
27
27
28
def set_config (self , config ):
28
29
""" Directly sets the internal config object. """
@@ -47,10 +48,16 @@ def read_config(self, tenant):
47
48
dataout = ENVVAR_PATTERN .sub (envrepl , data )
48
49
self .config = json .loads (dataout )
49
50
except Exception as e :
50
- self .logger .error (
51
- "Could not load runtime config '%s':\n %s" %
52
- (runtime_config_path , e )
53
- )
51
+ if self .config_file_is_optional :
52
+ self .logger .info (
53
+ "Could not load runtime config '%s':\n %s\n However ignoring due to option config_file_is_optional being set to true" %
54
+ (runtime_config_path , e )
55
+ )
56
+ else :
57
+ self .logger .error (
58
+ "Could not load runtime config '%s':\n %s" %
59
+ (runtime_config_path , e )
60
+ )
54
61
self .config = {}
55
62
return self
56
63
0 commit comments