Skip to content

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

@avrahamcool

Description

@avrahamcool

💬 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions