I am having a hell of a time trying to access my encrypted environment vars from my node server. Any idea how to do this? I have tried process.env with no luck.
Your encryption appears incorrect. The decrypted variable is shown here as lqDnlCfd8zE1GTWYe0f5PL4jrucX4DMo0dy20P1rRSbHxovu2qNxdyye3ck23LsOhPejIs, whereas you are trying to access databaseUrl. What command did you run to obtain this?
Spoke too soon. My test repo is working but my real one is still failing. It looks like the value I am trying to encrypt is causing some issues. How do I escape/encode the encrypted value correctly?
Note on escaping certain symbols #
When you use travis encrypt to encrypt sensitive data, it is important to note that it will be processed as a bash statement. This means that secret you are encrypting should not cause errors when bash parses it. Having incomplete data will cause bash to dump the error statement to the log, which contains portions of your sensitive data.
Thus, you need to escape special characters such as braces, parentheses, backslashes, and pipe symbols. For example, when you want to assign the string 6&a(5!1Ab\ to FOO, you need to execute:
travis encrypt "FOO=6\\&a\\(5\\!1Ab\\\\"
Bash
travis encrypts the string FOO=6\&a\(5\!1Ab\\, which then bash uses to evaluate in the build environment.
Equivalently, you can do
travis encrypt 'FOO=6\&a\(5\!1AB\\'