Skip to content

Commit

Permalink
Refactor to accept dictionary as manifest category
Browse files Browse the repository at this point in the history
After discussing this PR in the Satellite Automation channel, I am going
in a different direction here. Instead of ingesting the settings from
external frameworks, Manifester's `__init__` method will now accept a
either a dictionary or a string as the `manifest_category` argument.
This should allow greater flexibility with how Manifester's settings are
stored and accessed when used with external frameworks and also reduce
the risk of settings collisions resulting from Manifester loading all
the settings of such a framework.
  • Loading branch information
synkd committed Aug 25, 2022
1 parent c06b552 commit f3cd617
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions manifester/manifester.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

class Manifester:
def __init__(self, manifest_category, allocation_name=None, **kwargs):
if isinstance(manifest_category, dict):
self.manifest_data = manifest_category
else:
self.manifest_data = settings.manifest_category.get(manifest_category)
self.allocation_name = allocation_name or "".join(
random.sample(string.ascii_letters, 10)
)
self.manifest_data = settings.manifest_category.get(manifest_category)
self.offline_token = kwargs.get(
"offline_token", self.manifest_data.get("offline_token", settings.offline_token)
)
self.offline_token = kwargs.get("offline_token", self.manifest_data.offline_token)
self.subscription_data = self.manifest_data.subscription_data
self.sat_version = kwargs.get("sat_version", self.manifest_data.sat_version)
self.token_request_data = {
Expand Down

0 comments on commit f3cd617

Please sign in to comment.