Skip to content

Commit

Permalink
Make AESecretProvider actually optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jvansanten committed Jan 8, 2025
1 parent 73d38ae commit c57e7ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ampel/config/builder/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from ampel.log.AmpelLogger import DEBUG, ERROR, VERBOSE, AmpelLogger
from ampel.log.utils import log_exception
from ampel.secret.AESecret import AESecret
from ampel.secret.AESecretProvider import AESecretProvider
from ampel.template.ChannelWithProcsTemplate import ChannelWithProcsTemplate
from ampel.util.mappings import dictify, get_by_path, set_by_path
from ampel.util.recursion import walk_and_process_dict
Expand Down Expand Up @@ -381,6 +380,7 @@ def build_config(self,

# Optionaly decrypt aes encrypted config entries
if pwds:
from ampel.secret.AESecretProvider import AESecretProvider

self.logger.info('Resolving AES secrets')
sp = AESecretProvider(pwds)
Expand Down
12 changes: 6 additions & 6 deletions ampel/core/AmpelContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ampel.base.AuxUnitRegister import AuxUnitRegister
from ampel.config.AmpelConfig import AmpelConfig
from ampel.config.builder.DisplayOptions import DisplayOptions
from ampel.secret.AESecretProvider import AESecretProvider
from ampel.secret.AmpelVault import AmpelVault

# Avoid cyclic import issues
Expand Down Expand Up @@ -89,15 +88,16 @@ def load(cls,
if vault is None:
vault = AmpelVault([])

if pwd_file_path and not pwds:
with open(pwd_file_path) as f:
pwds = [l.strip() for l in f.readlines()]

if pwds:
# AESecretProvider is optional
from ampel.secret.AESecretProvider import AESecretProvider
vault.providers.append(
AESecretProvider(pwds)
)
elif pwd_file_path:
with open(pwd_file_path) as f:
vault.providers.append(
AESecretProvider([l.strip() for l in f.readlines()])
)

db = AmpelDB.new(alconf, vault, one_db=one_db)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ampel-core"
version = "0.10.4"
version = "0.10.4.post0"
description = "Alice in Modular Provenance-Enabled Land"
authors = ["Valery Brinnel"]
maintainers = ["Jakob van Santen <[email protected]>"]
Expand Down

0 comments on commit c57e7ad

Please sign in to comment.