hab
hab copied to clipboard
Easily resolve HAB_FREEZE when inside of that config
This allows you to easily get a hab Config object for the hab config you are currently running inside of.
Currently you have to run this code:
import os
import hab
default_uri = "a/uri"
freeze = os.getenv('HAB_FREEZE')
uri = os.getenv('HAB_URI', default_uri)
resolver = hab.Resolver.instance()
if freeze:
cfg = hab.parsers.UnfrozenConfig(freeze, resolver)
else:
cfg = resolver.resolve(uri)
This Pull Request allows you to replace that code with.
resolver = hab.Resolver.instance()
cfg = resolver.resolve("a/uri", from_env=True)
Checklist
- [x] I have read the CONTRIBUTING.md document
- [x] I formatted my changes with black
- [x] I linted my changes with flake8
- [ ] I have added documentation regarding my changes where necessary
- [x] Any pre-existing tests continue to pass
- [ ] Additional tests were made covering my changes
Types of Changes
- [ ] Bugfix (change that fixes an issue)
- [x] New Feature (change that adds functionality)
- [ ] Documentation Update (if none of the other choices apply)