Skip to content

Instantly share code, notes, and snippets.

@dball

dball/deploy.clj Secret

Created October 26, 2017 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dball/a98c18cbbcc0faf61a37b750eb668dbd to your computer and use it in GitHub Desktop.
Save dball/a98c18cbbcc0faf61a37b750eb668dbd to your computer and use it in GitHub Desktop.
(c/deftask push-config
"Pushes the output resources as config to AWS"
[e env VAL str "The environment"
n name VAL str "The application name"]
(let [s3-config (find-s3-config! env)
{:strs [bucket]} s3-config
path (format "apps/%s/env/%s/config" name env)
s3-url (format "s3://%s/%s" bucket path)
tmp (c/tmp-dir!)
sync! (#'c/fileset-syncer [tmp] :clean true :link false)]
(fn middleware [next-handler]
(fn handler [fileset]
(sync! fileset)
(let [args ["aws" "s3" "cp" (.getAbsolutePath tmp) s3-url "--recursive"]]
(apply util/dosh args))
(next-handler fileset)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment