Rails: ENV variable failure outputs double string

103 views Asked by At

I have a rake task that requires 3 of my environment variables. 2 of them pass fine but one keeps outputting inside a double-string causing an error.

Here is a what I have in my .bash_profile

export FG_PASSWORD=“mysecret”
export FG_USERNAME=“[email protected]”
export FG_DOMAIN=“secret”

In Rails I setup them up here..

config/initializers/api.rb

FG_PASSWORD = ENV["FG_PASSWORD"]
FG_USERNAME = ENV["FG_USERNAME"]
FG_DOMAIN = ENV["FG_DOMAIN"]

My rake task...

lib/rake/upload_files.rake

namespace :upload_files do
    task :upload_base => :environment do
        c = Foldergrid::Connection.new(FG_PASSWORD, FG_USERNAME, FG_DOMAIN)
        p FG_DOMAIN

        ....some code...
    end
end

The culprit is the FG_DOMAIN. It works when hard-coded. The p FG_DOMAIN line outputs the variable as ""secret"" hence the double-string.

Any insight?

1

There are 1 answers

1
infused On

Remove the quotes from the export statements. They should look like:

export FG_PASSWORD=mysecret
export [email protected]
export FG_DOMAIN=secret