Mina: How to ENV variables

Created on 30 Oct 2012  ·  10Comments  ·  Source: mina-deploy/mina

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.

Most helpful comment

@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.

All 10 comments

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

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

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

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

this is OK !!!! Thanks

Try:

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

On Oct 30, 2012, at 6:11 PM, Simon COURTOIS [email protected]
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/nadarei/mina/issues/65#issuecomment-9900324.

As stated earlier, this should work:

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

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

# .bashrc
export NAME="hello"

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

I use Figaro

require 'yaml'

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

@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.

@lulalala thanks, it worked for me!

I set bundle_prefix like this:

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jakoss picture jakoss  ·  3Comments

sosedoff picture sosedoff  ·  9Comments

Ilya-Kuchaev picture Ilya-Kuchaev  ·  4Comments

folivi picture folivi  ·  4Comments

Epigene picture Epigene  ·  3Comments