Config in CWD and resolve ABRA_DIR #4

Open
dannygroenewegen wants to merge 1 commits from eCommons/alakazam:config-location into main
First-time contributor

Added support for reading alakazam.yml from CWD and fallback to ~/.config/alakazam.yml. This allows working with a completely separate path for e.g. development.
I also had abra configured with a different abra_dir. When alakazam runs abra, it uses the configured abra dir, but alakazam also had some hardcoded references to ~/.abra. I added get_abra_dir() with the same logic that abra uses internally and replaced all hardcoded references.

  • Support alakazam.yml in CWD
  • Resolve ABRA_DIR using env var or abra.yml instead of hardcoding ~/.abra
  • Add ABRA_DIR to exclude_paths when inside root
Added support for reading alakazam.yml from CWD and fallback to ~/.config/alakazam.yml. This allows working with a completely separate path for e.g. development. I also had abra configured with a different abra_dir. When alakazam runs abra, it uses the configured abra dir, but alakazam also had some hardcoded references to ~/.abra. I added get_abra_dir() with the same logic that abra uses internally and replaced all hardcoded references. - Support alakazam.yml in CWD - Resolve ABRA_DIR using env var or abra.yml instead of hardcoding ~/.abra - Add ABRA_DIR to exclude_paths when inside root
dannygroenewegen added 1 commit 2026-04-07 12:27:37 +00:00
- Resolve ABRA_DIR using env var or abra.yml instead of hardcoding ~/.abra
- Add ABRA_DIR to exclude_paths when inside root
decentral1se reviewed 2026-04-08 21:48:38 +00:00
decentral1se left a comment
Owner

Woah, super cool @dannygroenewegen! Great to see this happening. Driving by but LGTM! Not to demand too much but probably it would be pretty easy to create a unit test for get_abra_dir. We have to start writing tests eventually 🙃 I trust @moritz will know better.

Woah, super cool @dannygroenewegen! Great to see this happening. Driving by but LGTM! Not to demand too much but probably it would be pretty easy to create a unit test for `get_abra_dir`. We have to start writing tests eventually 🙃 I trust @moritz will know better.
simon requested review from simon 2026-05-07 11:30:13 +00:00
simon requested review from moritz 2026-05-07 11:30:13 +00:00
moritz requested changes 2026-05-11 13:54:30 +00:00
moritz left a comment
Owner

Thank you for this PR 🚀. It's a nice feature to be able to have completely different project dirs, each separately configured.
I'm just curious for which use cases you use it? I think it's good if you don't want to have any global defaults for all of your projects. Else you would have all of your projects inside one main directory, which contains your global defaults.

On thing that stopped me from directly merging this, is that it only uses the alakazam.yml inside the current path, but if you run alakazam from any sub directory in your project it would fall back to "~/.config/alakazam.yml", which could lead to some confusing behaviour.

Thank you for this PR 🚀. It's a nice feature to be able to have completely different project dirs, each separately configured. I'm just curious for which use cases you use it? I think it's good if you don't want to have any global defaults for all of your projects. Else you would have all of your projects inside one main directory, which contains your global defaults. On thing that stopped me from directly merging this, is that it only uses the `alakazam.yml` inside the current path, but if you run `alakazam` from any sub directory in your project it would fall back to `"~/.config/alakazam.yml"`, which could lead to some confusing behaviour.
@ -55,3 +55,3 @@
#}
SETTINGS = {}
SETTINGS_PATH = "~/.config/alakazam.yml"
SETTINGS_PATH = "alakazam.yml" if Path("alakazam.yml").exists() else "~/.config/alakazam.yml"
Owner

To be able to use the project specific alakazam.yml in nested directories, it would be good to use a function similar to get_abra_dir() to find alakazam.yml inside the parent dirs.

To be able to use the project specific `alakazam.yml` in nested directories, it would be good to use a function similar to `get_abra_dir() ` to find `alakazam.yml` inside the parent dirs.
@ -467,8 +467,27 @@ def generate_all_secrets(domain: str) -> None:
print(f"\t {gen_sec['name']}: {gen_sec['value']}")
def get_abra_dir() -> Path:
Owner

A little docstring what this function is doing would be nice.

A little docstring what this function is doing would be nice.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u config-location:eCommons-config-location
git checkout eCommons-config-location
Sign in to join this conversation.
No Reviewers
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/alakazam#4
No description provided.