deploy icon indicating copy to clipboard operation
deploy copied to clipboard

feat: To add env variables caching mechanism.

Open Creatoon opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Currently, we deploy applications with environment variables but our "Deploy CLI" doesn't have an env variable caching mechanism.

Describe the solution you'd like What I think is, we should store a particular application config at the below path:

$  .metacall/deploy/applications/projectName.ini

For Ex:

$  .metacall/deploy/applications/auth-middleware.ini

Now, Why I think it should look like that is because:-

  1. We can store all application data in a single folder and it's nicely separated
  2. Name of the file is like -> projectName.ini -> All the config of those applications having the same name and located in different paths can be accumulated here, one-stop solution

Let's see config file structure

[path.home_raj_desktop_authMiddleware.plan.essential.env]
ENVIROMENT=dev
PORT=5000
HOST=localhost
USER=Creatoon
MAILCHIMP_API_KEY=fssdgdfgfg565756867993ddcbbcbc

[path.home_raj_desktop_authMiddleware.plan.standard.env]
ENVIROMENT=prod
PORT=9000
HOST=https://creatoon.tech
USER=SuperUser
MAILCHIMP_API_KEY=fssdgdfgfg565756867993ddcbbcbc

[path.home_raj_desktop_authMiddleware.plan.premium.env]
ENVIROMENT=prod
PORT=8000
HOST=https://creatoon.tech
USER=SuperUser
MAILCHIMP_API_KEY=fssdgdfgfg565756867993ddcbbcbc

Why this kind of config structure? It's simply because there may be a case when a user deploys a minimal version of an application on "Essential" Plan with some environment variables & production-grade version on "Standard and Premium" Plans with different values of env variables, that's why I figured out this structure for caching.

So after parsing it would look something like this:

{
  path: {
    home_raj_desktop_authMiddleware : {
      plan : {
        essential : {
          env: {
            ENVIROMENT: "dev",
            PORT: 5000,
            HOST: "localhost",
            USER: "Creatoon",
            MAILCHIMP_API_KEY: "fssdgdfgfg565756867993ddcbbcbc"
          }
        },
        standard : {
          env: {
            ENVIROMENT: "prod",
            PORT: 9000,
            HOST: "https://creatoon.tech",
            USER: "SuperUser",
            MAILCHIMP_API_KEY: "fssdgdfgfg565756867993ddcbbcbc"
          }
        },
        premium : {
          env: {
            ENVIROMENT: "prod",
            PORT: 8000,
            HOST: "https://creatoon.tech",
            USER: "SuperUser",
            MAILCHIMP_API_KEY: "fssdgdfgfg565756867993ddcbbcbc"
          }
        }
      }
    }
  }
  
  
}

Additional Context We should also think about, what if the user re-deploys with some additional environment variables then we should give him an option to add more and update ones that are already cached.

@trgwii @viferga What do you think sir? If you think it is incorrect or whatever you think about it, let me discuss it.

Thanks

Creatoon avatar Feb 12 '22 12:02 Creatoon

I think the best option may be caching them in the backend. But this idea can be reused for caching other things like preferences (no secrets). So until we implement this, I am going to leave this issue open.

viferga avatar Feb 25 '22 10:02 viferga

I would like to work on this Issue if not resolved @Creatoon @viferga

ashutosh887 avatar Feb 16 '23 14:02 ashutosh887

@ashutosh887 At current stage we are not caching prefs on deploy cli side, instead we are caching it on the backend (faas side)

Creatoon avatar Feb 16 '23 15:02 Creatoon