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

How to pass ConfigurationOptions to Configuration? #73

Closed
discover59 opened this issue Aug 16, 2021 · 8 comments
Closed

How to pass ConfigurationOptions to Configuration? #73

discover59 opened this issue Aug 16, 2021 · 8 comments

Comments

@discover59
Copy link

I prefer to use dynamic ConfigurationOptions for dynamic sellers and pass it to Configuration.
But it doesn't accept that type which is confusing.

Please let me know what I can use for this purpose.

@jlevers
Copy link
Owner

jlevers commented Aug 16, 2021

The ConfigurationOptions object was removed in v3 of this library. The Configuration object now just accepts an array of options -- check out the README for details.

@jlevers jlevers closed this as completed Aug 16, 2021
@discover59
Copy link
Author

@jlevers What's the best way to use dynamic refresh token with same other information?

@jlevers
Copy link
Owner

jlevers commented Aug 16, 2021

I would store the static info in environment variables using something like vlucas/phpdotenv, and then load those environment variables into the Configuration constructor.

@discover59
Copy link
Author

Hmm, this is not comfortable compared to other libraries I used for MWS.

@jlevers
Copy link
Owner

jlevers commented Aug 16, 2021

MWS was a much simpler system than the SP API.

I originally set up this library to load config info from environment variables by default, but the very first issue someone opened (#1) was a request to leave the environment setup to the user. I thought that was a good point, so I've since changed the library to be more configurable, at the expense of requiring a little more setup for certain use cases.

Using this library with your your own env vars would require installing the package I linked, creating a .env file, and loading the variables in that file into a function or factory class that produces Configuration objects (a couple lines of code).

If you have suggestions for a different way this should work, I'm open to hearing them :)

@discover59
Copy link
Author

I am using .env already, but the case is for multiple sellers and I have to update refresh token and region in the loop of operation.
I don't want to include other redundant variables in the loop.
That's why I prefer the configuration object updatable by different setters.

https://github.com/clousale/amazon-sp-api-php

Above library does it.

@jlevers
Copy link
Owner

jlevers commented Aug 18, 2021

If something as simple as getters and setters for the configuration options would solve the issue you're having, I'm happy to make that change. I'll try to get that done in the next couple weeks.

@jlevers
Copy link
Owner

jlevers commented Sep 16, 2021

@discover59, those getters and setters have been added in v3.1.4.

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