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

Default $_environment should be ready for production #61

Open
intradeus opened this issue Jul 19, 2023 · 1 comment
Open

Default $_environment should be ready for production #61

intradeus opened this issue Jul 19, 2023 · 1 comment

Comments

@intradeus
Copy link

intradeus commented Jul 19, 2023

Problem

I think that by default the variable $_environment in Configuration.php should be set to "production", not null.

I feel like if someone specifically wants no SSL, then he can use Trolley\Configuration::environment("localhost"); and if you're doing development on the library, then you can use development , but by default SSL should be enabled and the https://api.trolley.com API_SERVER should be used, like set in production 😃

Do you agree ?

Fix proposed

You could set private $_environment = "production"

OR

You could modify the code to allow a null $_environment everywhere in it

Ex: I noticed an issue in the sslOn() function that throws an error when the string is empty because the 1st param of substr() function (Configuration.php line 473 ) cannot be null :

substr(): Passing null to parameter #1 ($string) of type string is deprecated
in vendor\/trolley\/core\/lib\/Trolley\/Configuration.php

OR
(not really a fix but it would have saved me half an hour)
You could document that users have to use Trolley\Configuration::environment("production"); in the readme

Or maybe you have another idea, or there's a reason for that specific setup due to concerns I haven't already met...

Thank you !

@Aman-Aalam
Copy link
Member

Thanks @intradeus , that's a good suggestion.
We do have api.trolley.com returned by default and any value of environment except development is ignored (see this: https://github.com/trolley/php-sdk/blob/master/lib/Trolley/Configuration.php#L438)

If you don't specify any environment in the latest version, we default to using the production version.
Did you not see this behavior?

We detailed about this change when we released the new version - check #3 here in the release notes: https://github.com/trolley/php-sdk/releases/tag/3.0.0

We can also set up development environment when running from source, but you're right the $_environment variable is set to null.

Can you share an example of what you're trying to achieve so we know the use case better?

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

No branches or pull requests

2 participants