goodconf/__init__.py
def load(self, filename: str = None):
        """Find config file and set values"""
        if filename:
            self.config_file = _find_file(filename)
        else:
            if self.file_env_var and self.file_env_var in os.environ:
                self.config_file = _find_file(os.environ[self.file_env_var])
            if not self.config_file:
                for filename in self.default_files:
                    self.config_file = _find_file(filename, require=False)
                    if self.config_file:
                        break
        if self.config_file:
            config = _load_config(self.config_file)
            log.info("Loading config from %s", self.config_file)
        else:
            config = {}
            log.info("No config file specified. "
                     "Loading with environment variables.")
        self.set_values(config)
def load(self, filename: str = None):
        if filename:
            self.config_file = _find_file(filename)
        else:
            if self.file_env_var and self.file_env_var in os.environ:
                self.config_file = _find_file(os.environ[self.file_env_var])
            if not self.config_file:
                for filename in self.default_files:
                    self.config_file = _find_file(filename, require=False)
                    if self.config_file:
                        break
        if self.config_file:
            config = _load_config(self.config_file)
            log.info("Loading config from %s", self.config_file)
        else:
            config = {}
            log.info("No config file specified. "
                     "Loading with environment variables.")
        self.set_values(config)
def load ( self , filename : str = None ) : if filename : self . config_file = _find_file ( filename ) else : if self . file_env_var and self . file_env_var in os . environ : self . config_file = _find_file ( os . environ [ self . file_env_var ] ) if not self . config_file : for filename in self . default_files : self . config_file = _find_file ( filename , require = False ) if self . config_file : break if self . config_file : config = _load_config ( self . config_file ) log . info ( "Loading config from %s" , self . config_file ) else : config = { } log . info ( "No config file specified. " "Loading with environment variables." ) self . set_values ( config )
Find config file and set values
Find config file and set values