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

fix: convert USE_RELOADLY_SANDBOX to bool #1

Closed
wants to merge 1 commit into from

Conversation

rndquu
Copy link

@rndquu rndquu commented Aug 7, 2024

I was trying to run pay.ubq.fi with production reloadly credentials locally and somehow env.USE_RELOADLY_SANDBOX ends up to be of boolean type instead of a string declared here. Hence this option didn't really work as expected because here boolean type is compared with a string type which always ended up in a false thus always working with a sandbox environment.

The JSON.parse() approach is pretty bool/string agnostic for testing locally (when env.USE_RELOADLY_SANDBOX ends up to be of boolean type) or via CI (example where USE_RELOADLY_SANDBOX is a string).

Copy link

@EresDev EresDev left a comment

Choose a reason for hiding this comment

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

This option had been a problem before. What I missed here is to turn USE_RELOADLY_SANDBOX = "true"
Turning true to string in quotes here. Or maybe leave a comment here too.

Also, there is inconsistency how wrangler treats this true, and when this true gets into env vars of cloudflare, it returns string. But in wrnagler.toml without quotes, it returns boolean. Adding quotes here around value just solves the problem.

I wanted to keep it strict to switch off sandbox. The problem is Reloadly production will soon have funds in it and a mistake by user can end up purchasing a card during development and there is no way to undo that.

Your change with JSON.parse is very nice. But it can switch off sandbox in some unexpected ways too.
image

Edit:

Please ignore the above image. I see I tried it incorrectly. used incorrect order in the ternary operator. I am going to try it a little more and proceed accordingly.

@rndquu
Copy link
Author

rndquu commented Aug 7, 2024

Closing this in favor of #2

@rndquu rndquu closed this Aug 7, 2024
@EresDev
Copy link

EresDev commented Aug 7, 2024

Closing this in favor of #2

Thanks.

Probably will change USE_RELOADLY_SANDBOX = "yes/no" later. Boolean strings true/false will keep creating confusion for anyone new. But will do this with next major change as this will break the existing deployment.

@rndquu rndquu deleted the fix/sandbox-env-string branch October 11, 2024 08:21
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