Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass environment variables to Zeus

When I run zeus:

MY_VAR=MY_VALUE zeus start

Environment stays with that that variable, let's say I want to run Rails server with MY_VAR=MAY_VALUE_2

I have tried:

MY_VAR=MAY_VALUE_2 zeus s

But it does not work. I am using oh-my-zsh, in case that's important.

How can I do that?

like image 268
sites Avatar asked Dec 20 '22 06:12

sites


2 Answers

Don't know if you still need help with but if you want to be able to store environmental variables in a file you can use the custom_plan.rb that is generated with zeus init. Below is a copy of my file. I am using Omniauth and need my keys to be easily changeable. You can add server only variables by overloading the server method instead, just know that your initializers will be ran before the server command.

require 'zeus/rails'

class CustomPlan < Zeus::Rails

  def boot

    # Omniauth Keys

    # GOOGLE+
    ENV['GPLUS_KEY']       = 'xxx'
    ENV['GPLUS_SECRET']    = 'xxx'

    # FACEBOOK
    ENV['FACEBOOK_KEY']    = 'xxx'
    ENV['FACEBOOK_SECRET'] = 'xxx'

    super # Finish boot
  end
end

Zeus.plan = CustomPlan.new
like image 136
Nick Avatar answered Dec 22 '22 20:12

Nick


Passing it in zeus start

SOME_ENV_VAR=test zeus start

like image 25
Simon Liu Avatar answered Dec 22 '22 19:12

Simon Liu