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

Environment variables usage #150

Open
e1himself opened this issue Jun 1, 2022 · 1 comment
Open

Environment variables usage #150

e1himself opened this issue Jun 1, 2022 · 1 comment

Comments

@e1himself
Copy link
Contributor

I've noticed that the theme app requires environment variables in order to properly function (at least locally), but the variables themselves are never used within this repo codebase at all. All the usages are actually in the theme-kit package.

I believe this breaks the separation of concerns principle. I cannot modify this theme to do something else with the env variables, or to instantiate the Prezly API client with my own local dev API endpoint.

It would be better if the outsourced theme-kit code was providing entry points expecting the required inputs (like tokens/env variables, or an instantiated API Client instance) and then performed its job.

Of course, this is by all means, not a critical problem. Just something rather good to have.

@riffbyte
Copy link
Contributor

riffbyte commented Jun 1, 2022

I cannot modify this theme to do something else with the env variables, or to instantiate the Prezly API client with my own local dev API endpoint.

Actually, you can do both of these things :)

  • theme-kit-nextjs exports getEnvVariables method, which collects everything from process.env locally (or you can simply use good old process.env).
  • API URL override is not a documented feature, but it is there in the code

I agree that this abstraction might not be the best in terms of intuitiveness, but it does help to reduce the boilerplate. The env variables needed to run the theme locally are documented both in the Theme Kit and the theme repos, so I don't see this as a big problem, at least for now.

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