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

[RFC] Better way of handling environment files (config files) #1039

Open
avrahamcool opened this issue Feb 6, 2019 · 2 comments
Open

[RFC] Better way of handling environment files (config files) #1039

avrahamcool opened this issue Feb 6, 2019 · 2 comments

Comments

@avrahamcool
Copy link
Contributor

avrahamcool commented Feb 6, 2019

💬 RFC

I want to talk about handling variable that are environment specific in aurelia.

the way that we handle it now, is by having multiple json files in an environment folder,
when we start a build process - one of those files is copied into the src folder, and gets bundled with the rest of the app.
you can dictate witch file is copied by specifying the "--env" flag while building.

in those files, you can put whatever you want - so it's an easy way to have variables that differ between environments.

I see 2 different kind of variables that can go into those config files.

  1. build time variables: variables that affect the build - (e.g minifying the code, enabling/disabling logging, enabling/disabling sourcemap etc.).
    setting different values in those variables should result in different build output.
  2. run time variables: variable that affect the application - (e.g api url endpoints, api keys, ticket duration etc)
    setting different values in those variables should not affect the build output.
    one may change those values even after the build and expect the app to consider the new values.
    this is currently cannot be done because the config file is bundled along with the application.
    any change to the config must also come with a new build.

the current way of handling config files has another problems/limitations:

  1. it's annoying to have a file in the src folder - that should not be committed into the source control.
  2. TFS adds readlony attributes to all the files that he manages - so copying one of the config files work only once, the next time you try to build - the file cannot be overwritten because of the readonly flag. Readonly attribute on environment scipt file #1031

what can we do about this?
how does other framework handle config files?
can we have 2 sort of configs? one for build time variables? and another for run time variables?
can we even have files that are left outside of the bundle for easy editing?
can we skip the part where we copy the file into src?

@avrahamcool
Copy link
Contributor Author

avrahamcool commented Feb 6, 2019

Maybe something like this?

https://robinraju.github.io/developer/2017-11-14-loading-external-config-in-angular

But better.. Obviously

@3cp
Copy link
Member

3cp commented Sep 17, 2019

@avrahamcool latest webpack setup addressed parts of this, it uses app-settings-loader to avoid coping env file.

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