Shopify / ejson

EJSON is a small library to manage encrypted secrets using asymmetric encryption.
MIT License
1.34k stars 62 forks source link

adds ejson2env #52

Closed catherinejones closed 6 years ago

catherinejones commented 6 years ago

This pull request adds the ejson2env command, which aids with the export of environment variables stored in ejson files.

For example, with an ejson file containing:

{
    "_public_key": "<key>",
    "environment": {
        "DB_PASSWORD": "EJ[1:OrYT5AaCMOtskq44s2rIzZnoeWW9y5ciYEiV8FWAORc=:vlYfnSz0wuGHKXZ1yFqVnFP5PYrTNyMs:UR5ZeX7BnDWeoAjiy1Rp/nTDWsmmYtJrWmI=]"                                                                                                                               
    }
}

Running ejson2env would output:

export DB_PASSWORD=test1234

This command would then be called in entrypoint shell scripts.

burke commented 6 years ago

Sorry I didn't get a chance to look at this today, I'll try to get to it Tuesday. Mostly good at least. We're going to have to update the Makefile too, and probably ejson.rb in Shopify/homebrew-shopify.