def get_and_update_setting(self, name, default=None): '''Look for a setting in the environment (first priority) and then the settings file (second). If something is found, the settings file is updated. The order of operations works as follows: 1. The .sregistry settings file is used as a cache for the variable 2. the environment variable always takes priority to cache, and if found, will update the cache. 3. If the variable is not found and the cache is set, we are good 5. If the variable is not found and the cache isn't set, return default (default is None) So the user of the function can assume a return of None equates to not set anywhere, and take the appropriate action. ''' setting = self._get_setting(name) # If the setting is found, update the client secrets if setting is not None: updates = {name: setting} update_client_secrets(backend=self.client_name, updates=updates) if setting is None and default is not None: setting = default return setting
def update_setting(self, name, value): '''Just update a setting, doesn't need to be returned. ''' if value is not None: updates = {name: value} update_client_secrets(backend=self.client_name, updates=updates)