Linux : Unix : Update $PATH

If you want to put any diectory into loadpath or to your PATH environment variable. You can

  • simple go to that directory
    • $ cd path/to/that/dir
    • $ PATH=$PATH:$(pwd)
    • Where
      • PATH= will set the $PATH var
      • $(pwd) is function call; will call the unix command pwd which will give you the path to the current  working directory
      • Overall; with append content to $PATH var with : conjunction or separator; which will separate two paths

Ruby on Rails : Forman : Passing Environment variables and secrets

With foreman you can use .env files to declare the environment variables for your app (and it’s dependencies) and maintain them isolated from the rest of your environment. So, if you’re using theaws-sdk gem, your .env file would look like:

AWS_ACCESS_KEY_ID=your_api_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_REGION=us-west-2

And foreman automatically loads the .env file that is at the same directory as your Procfile.

This way you can make all environment specific configuration for your app to live at this .env file and let every developer set their own specific configurations here. All variables declared here will be available for all processes started by foreman as environment variables.

Continue reading

Engineyard : Ruby On Rails : Setting environment variables at once

I was also using Heroku previously now I moved to Engineyard. This is how I get my ENvironemnt variables in Heroku I added gem figaro. This gem basically needs file application.yml in app/config directory. When Rails app is initialized, it gets executed and loads the key value pair set in YAML format into memory. In Heroku Figaro has option to set the content of application.yml. Continue reading

Engineyard : Deployment : Passing multiple Environment variables to deploy hooks

Engineyard has made it easier to send environment variables to deploy hook when you execute the deployment command from client console. Environment variable is not the exact terminology to be used. EY sends it as configuration hash.  You may want/need to send environment variables in situations such as:

  • When you want to detect that this is the attempt when you want your seeds ( Data defined in seed.rb) to be committed to database.
  • When you want specific services or packages like Elastic Search to reindex the records

Continue reading