Skip to content

Commit

Permalink
fix: ruff conformity BLOOM_CONFIG=>bloom_config
Browse files Browse the repository at this point in the history
  • Loading branch information
herve.le-bars committed Mar 6, 2024
1 parent af1effe commit e54b55f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bloom/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def __init__(self):
self.data_folder = Path(__file__).parent.parent.parent.joinpath('./data')

# Si le fichier de configuration à charger est précisé par la variable d'environnement
# BLOOM_CONFIG alors on charge ce fichier, sinon par défaut c'est ../.env
BLOOM_CONFIG=os.getenv('BLOOM_CONFIG',Path(__file__).parent.joinpath(".env"))
# BLOOM_CONFIG alors on charge ce fichier, sinon par défaut c'est <project>/.env
bloom_config=os.getenv('BLOOM_CONFIG',Path(__file__).parent.parent.parent
.joinpath(".env"))

# Ici on charge les paramètres à partir du fichier BLOOM_CONFIG
# et on mets à jour directement les valeurs des paramètres en tant qu'attribut de la
Expand All @@ -101,8 +102,9 @@ def __init__(self):
# mas aussi dans le fichier BLOOM_CONFIG ainsi qu'en tant que variable d'environnement
# alors c'est la valeur de la variable d'environnement qui sera chargée au final
# La priorité est donnée aux valeur de l'environnement selon le standard Docker
if Path(BLOOM_CONFIG).exists():
extract_values_from_file(BLOOM_CONFIG,self.__dict__,allow_extend=False,env_priority=True)
if Path(bloom_config).exists():
extract_values_from_file(bloom_config,self.__dict__,allow_extend=False,
env_priority=True)
else:
extract_values_from_env(self.__dict__,allow_extend=False)

Expand Down

0 comments on commit e54b55f

Please sign in to comment.