metacall / deploy

Tool for deploying into MetaCall FaaS platform.
https://dashboard.metacall.io
Apache License 2.0
18 stars 30 forks source link

feat: To add env variables caching mechanism. #28

Open Creatoon opened 2 years ago

Creatoon commented 2 years ago

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

viferga commented 2 years ago

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.

ashutosh887 commented 1 year ago

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

Creatoon commented 1 year ago

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