-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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; |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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
Hi @whitte-h Thanks for the PR. I added some feedback. LMK what you think. |
Changes