Skip to content
This repository has been archived by the owner on Oct 22, 2022. It is now read-only.

Variables validator #86

Open
zrzka opened this issue May 29, 2017 · 2 comments
Open

Variables validator #86

zrzka opened this issue May 29, 2017 · 2 comments

Comments

@zrzka
Copy link
Contributor

zrzka commented May 29, 2017

Story

Our projects heavily rely on :cljs-lambda :defaults :env. Also, we have production variables set in the :production profile (profiles.clj). Sometimes we forget to ...

  • add env variable to profiles.clj,
  • replace TODO with production value (waiting for CF template changeset to be deployed),
  • set env variable (for example #=(eval (System/getenv "STRIPE_API_KEY_SECRET"))) and dev value is deployed to production,
  • ...

Repetitive tasks, prone to error, ... Boring, no one wants to do them.

Idea

My idea is to enhance cljs-lambda plugin with some validation task. Something like:

  • Are all env keys in project.clj set in profiles.clj?
  • Does profile.clj contain TODO as a value for any key?
  • Do these values differ?

Do you think it's good enhancement for cljs-lambda plugin or we should create new plugin? Honestly, not sure if I can come up with generic validator, with enough parameters, to suit needs for lot of people. Our cases are described above, but there can be lot of other cases. Also not sure if plugin can read all these combinations from project & profile files without merging, etc. Didn't test it yet, just thinking aloud.

@moea
Copy link
Member

moea commented May 29, 2017

If you don't want to handle this at runtime, maybe the most specific thing that feels like it belongs in cljs-lambda would be a task which prints out the effective config map (either for all functions, or for a specific function). You could then have a project-specific script which looks at the output of lein with-profile production cljs-lambda dump-config important-function or, alternatively, ... cljs-lambda deploy :dry-run, which would just log the AWS CLI commands, but I suspect that the first might be a little easier to parse. Would that be helpful at all?

@zrzka
Copy link
Contributor Author

zrzka commented May 31, 2017

If it prints out effective config, per lambda function, for all functions / selected functions, it would be enough and I can handle it via another script which captures output. I'll create dump-config POC and then we can discuss possible changes. If it will not fit cljs-lambda in some way, I can create another plugin, not an issue.

moea pushed a commit that referenced this issue Jun 4, 2017
* Effective function configurations dump #86

* Merge dump-configs! into dump-config task
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants