Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to ENV variables #65

Closed
misteral opened this issue Oct 30, 2012 · 10 comments
Closed

How to ENV variables #65

misteral opened this issue Oct 30, 2012 · 10 comments

Comments

@misteral
Copy link

is Gemfile line

gem 'spree', '1.2.0', :git => "https://#{ENV['GUSER']}:#{ENV['GPASS']}@bitbucket.org/constella/spree.git", :branch => "1-2-stable"

how i can set variable GUSER and GPASS ?

.bashrc on server - not
.profile on server - not
queue! "export GUSER=memo" in deploy - no

You have changed in the Gemfile:
* spree from https://:@bitbucket.org/constella/spree.git (at 1-2-stable) to no specified source

ERROR: Deploy failed.

@simonc
Copy link

simonc commented Oct 30, 2012

I agree, an environment_variables should be available to provide variables shared across commands while deploying.

@simonc
Copy link

simonc commented Oct 30, 2012

Maybe you can set the bundle_bin variable to add the environment variables:

set :bundle_bin, 'GUSER=xxx GPASS=yyy bundle'

@misteral
Copy link
Author

set :bundle_bin, 'GUSER=xxx GPASS=yyy bundle'

this is OK !!!! Thanks

@rstacruz
Copy link
Member

Try:

task :env do
queue %[NAME="hello"]
end

On Oct 30, 2012, at 6:11 PM, Simon COURTOIS notifications@github.com
wrote:

I agree, an environment_variables should be available to provide variables
shared across commands while deploying.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/65#issuecomment-9900324.

@rstacruz
Copy link
Member

As stated earlier, this should work:

task :env do
   queue %[NAME="hello"]
end

@rstacruz
Copy link
Member

Also, if you want to put it in .bashrc instead (IMHO a much better idea!), you should export the variables:

# .bashrc
export NAME="hello"

@pricees
Copy link
Contributor

pricees commented Jan 9, 2014

Can you believe there is still no environment variable option? Goodness grief! Well, I think we may fork this thang and add an env-var option but until then we are using a big time hack.

We store our variables locally in an .env file

under the settings we put:

# Non-cowboys, don't try this in production.
set :ssh_options, %{export #{File.open(".env").readlines.map(&:chomp).join(" ")}}

You get the gist and can make it pretty yourself. This is one way to Heroku-tize our deploy.

Happy hacking,
Best.
Ted

@phanhaiquang
Copy link

I use Figaro

require 'yaml'

set :var_from_env, -> { YAML.load_file("./config/application.yml")["ENV_VAR"] }

@lulalala
Copy link

lulalala commented Mar 5, 2018

@rstacruz

May I ask is there a doc for task :env do? It does not append ENV setting in the command.

I used set :bundle_prefix to achieve this.

@AldanaQuintana
Copy link

@lulalala thanks, it worked for me!

I set bundle_prefix like this:

set :bundle_prefix, 'env $(cat .env | xargs) bundle exec '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants