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

Use env variables to setup #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

whitte-h
Copy link

Changes

  • Now it uses alfred env variables to set up the api key and the default currency

@@ -2,7 +2,7 @@

function getRow($currency_from, $currency_to, $amount){
// build URL
$url = "https://v6.exchangerate-api.com/v6/f3a28ea08292d915f7e45eee/pair/" . $currency_from . "/" . $currency_to;
$url = "https://v6.exchangerate-api.com/v6/" . getenv('API_KEY') . "/pair/" . $currency_from . "/" . $currency_to;
Copy link
Owner

Choose a reason for hiding this comment

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

If no env var is set it should use f3a28ea08292d915f7e45eee as the default.


if(!empty($matches)){

$amount = $matches[1];
$currency_from = $matches[2];
$currency_to = isset($matches[3]) ? $matches[3] : $default_currency;
$currency_to = isset($matches[3]) ? $matches[3] : getenv('DEFAULT_CURRENCY');
Copy link
Owner

Choose a reason for hiding this comment

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

If no DEFAULT_CURRENCY env var is set it should have a built in default

@sorenlouv
Copy link
Owner

Hi @whitte-h

Thanks for the PR. I added some feedback. LMK what you think.

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