11import os
22from configparser import ConfigParser
33
4- from securenative .config .configuration_builder import ConfigurationBuilder
4+ from securenative .config .securenative_options import SecureNativeOptions
55from securenative .exceptions .securenative_config_exception import SecureNativeConfigException
66
77
@@ -32,10 +32,6 @@ def _get_resource_path(cls, env_name):
3232
3333 return os .environ .get (cls .DEFAULT_CONFIG_FILE )
3434
35- @staticmethod
36- def config_builder ():
37- return ConfigurationBuilder .default_config_builder ()
38-
3935 @classmethod
4036 def _get_env_or_default (cls , properties , key , default ):
4137 if os .environ .get (key ):
@@ -46,21 +42,25 @@ def _get_env_or_default(cls, properties, key, default):
4642
4743 @classmethod
4844 def load_config (cls , resource_path ):
49- options = ConfigurationBuilder (). get_default_securenative_options ()
45+ options = SecureNativeOptions ()
5046
5147 if not resource_path :
5248 resource_path = os .environ .get (cls .CUSTOM_CONFIG_FILE_ENV_NAME )
5349
5450 properties = cls .read_resource_file (resource_path )
5551
56- return ConfigurationBuilder (). \
57- with_api_key (cls ._get_env_or_default (properties , "SECURENATIVE_API_KEY" , options .api_key )). \
58- with_api_url (cls ._get_env_or_default (properties , "SECURENATIVE_API_URL" , options .api_url )). \
59- with_interval (cls ._get_env_or_default (properties , "SECURENATIVE_INTERVAL" , options .interval )). \
60- with_max_events (cls ._get_env_or_default (properties , "SECURENATIVE_MAX_EVENTS" , options .max_events )). \
61- with_timeout (cls ._get_env_or_default (properties , "SECURENATIVE_TIMEOUT" , options .timeout )). \
62- with_auto_send (cls ._get_env_or_default (properties , "SECURENATIVE_AUTO_SEND" , options .auto_send )). \
63- with_disable (cls ._get_env_or_default (properties , "SECURENATIVE_DISABLE" , options .disable )). \
64- with_log_level (cls ._get_env_or_default (properties , "SECURENATIVE_LOG_LEVEL" , options .log_level )). \
65- with_fail_over_strategy (cls ._get_env_or_default (
66- properties , "SECURENATIVE_FAILOVER_STRATEGY" , options .fail_over_strategy ))
52+ return SecureNativeOptions (api_key = cls ._get_env_or_default (properties , "SECURENATIVE_API_KEY" , options .api_key ),
53+ api_url = cls ._get_env_or_default (properties , "SECURENATIVE_API_URL" , options .api_url ),
54+ interval = cls ._get_env_or_default (properties , "SECURENATIVE_INTERVAL" ,
55+ options .interval ),
56+ max_events = cls ._get_env_or_default (properties , "SECURENATIVE_MAX_EVENTS" ,
57+ options .max_events ),
58+ timeout = cls ._get_env_or_default (properties , "SECURENATIVE_TIMEOUT" , options .timeout ),
59+ auto_send = cls ._get_env_or_default (properties , "SECURENATIVE_AUTO_SEND" ,
60+ options .auto_send ),
61+ disable = cls ._get_env_or_default (properties , "SECURENATIVE_DISABLE" , options .disable ),
62+ log_level = cls ._get_env_or_default (properties , "SECURENATIVE_LOG_LEVEL" ,
63+ options .log_level ),
64+ fail_over_strategy = cls ._get_env_or_default (properties ,
65+ "SECURENATIVE_FAILOVER_STRATEGY" ,
66+ options .fail_over_strategy ))
0 commit comments