Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor config files #1510

Conversation

jemrobinson
Copy link
Member

@jemrobinson jemrobinson commented Jul 21, 2023

✅ Checklist

  • You have given your pull request a meaningful title (e.g. Enable foobar integration rather than 515 foobar).
  • You are targeting the appropriate branch. If you're not certain which one this is, it should be develop.
  • Your branch is up-to-date with the target branch (it probably was when you started, but it may have changed since then).
  • You have marked this pull request as a draft and added '[WIP]' to the title if needed (if you're not yet ready to merge).
  • You have formatted your code using appropriate automated tools (for example ./tests/AutoFormat_Powershell.ps1 -TargetPath <path to file or directory> for Powershell).

⤴️ Summary

  • Move external.api and external.interface into external (unnecessary nesting)
  • Separate PulumiStack into PulumiSHMStack and PulumiSREStack (better than changing behaviour with strings)
  • Move Azure authentication from mixin to external
  • Replaced DotFileSettings with better named BackendSettings
  • Store BackendSettings in appdirs config path instead of local directory
  • Simplify use of BackendSettings to only be updated in init and read during Config construction
  • Convert Config from a dotmap to a nested set of dataclasses (allows type-hinting to work correctly)

🌂 Related issues

Closes #1509

Check #1506 before merging

🔬 Tests

Tested locally

Copy link
Member

@JimMadge JimMadge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

I think this config structure makes more sense. Using dataclasses is sensible and will help with validation. (We could use something like pydantic, but I think that is overkill unless you have many dataclass-type classes).

It looks like this has enabled other places of the code to be tidied too.

data_safe_haven/config/backend_settings.py Outdated Show resolved Hide resolved
data_safe_haven/config/backend_settings.py Outdated Show resolved Hide resolved
data_safe_haven/config/backend_settings.py Outdated Show resolved Hide resolved
data_safe_haven/config/backend_settings.py Outdated Show resolved Hide resolved
data_safe_haven/config/backend_settings.py Outdated Show resolved Hide resolved
data_safe_haven/config/config.py Outdated Show resolved Hide resolved
data_safe_haven/config/config.py Outdated Show resolved Hide resolved
data_safe_haven/config/config.py Outdated Show resolved Hide resolved
data_safe_haven/config/config.py Outdated Show resolved Hide resolved
data_safe_haven/functions/validators.py Outdated Show resolved Hide resolved
@jemrobinson jemrobinson merged commit f0a8906 into alan-turing-institute:python-migration Jul 24, 2023
@jemrobinson jemrobinson deleted the refactor-config-files branch April 19, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants