babramczyk Posted December 21, 2020 Share Posted December 21, 2020 Desired Outcome: Being able to access zsh env vars in `Script`s in workflows (i.e. `$__TRELLO-TOKEN`), so that I can pass it to scripts (e.g. php) Rationale: Currently, my `Alfred.alfredpreferences` are tracked in my dotfiles repository. Because of that, I don't want to push any access tokens to GitHub. Since most workflows that touch third-party APIs require you to enter credentials that end up somewhere in source code, I want to put them in my `.zshrc__private` file and then access them in scripts (i.e. for the Trello workflow here: https://github.com/MikoMagni/Trello-Workflow-for-Alfred) Background: Initially, my Alfred preferences went into my dotfiles because I worked for an enterprise that disallowed Dropbox. I could move back to a Dropbox strategy at some point, but to be honest sometimes the version control is kind of nice (and simplifies things for me, as I don't have to bring in Dropbox as a dependency). Is there any way to do this? Link to comment
Alan He Posted December 23, 2020 Share Posted December 23, 2020 Alfred does not provide a direct way to access the environment. But you can have a workaround like this. 1. add run script ,like echo $HOME which is env environment 2. add arg and vars, set echo ouput as a variable 3. then you can use it at will. Link to comment
deanishe Posted December 23, 2020 Share Posted December 23, 2020 On 12/21/2020 at 9:57 PM, babramczyk said: Is there any way to do this? You would need to explicitly source the dotfile from your script within Alfred. Alfred (like all macOS apps) doesn't use your shell environment. Link to comment
babramczyk Posted December 29, 2020 Author Share Posted December 29, 2020 @deanishe perfect, that works great for my use case. Thanks! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now