sign inHome | Recent Changes | All Pages | HelpSearch:

Server Environment Variables

The defualt shell on all PLANET ARGON hosting accounts is bash. When you login via SSH and run commands, start your Rails applications, connect to your database… many applications will use your environment variables. You can define your own environment variables by modifying the file, ~/.bash_profile.

Rails Application Port Numbers

Append the following code to your ~/.bash_profile if you want to have your port numbers stored in environment variables.

PORTDIGITS=$(printf '%03d' $(($UID % 1000)))  # 2046 => '046', octal when numeric
portvalue=$(($UID % 1000))   # 9032 => 32, decimal number
export PROXYPORT=$((8000 + $portvalue))
export MONGPORT0=1${PORTDIGITS}0
export MONGPORT1=1${PORTDIGITS}1
# add more MONGPORTs if needed

PostgreSQL Environment Variables

Append the following code to your ~/.bash_profile.


#################################
# My PostgreSQL settings
#################################
# PostgreSQL Port
declare -i portvalue=$(($UID % 1000))   # 9032 => 32, decimal number

export PGPORT=$((5400 + $portvalue))

# PostgreSQL /bin path 
export PATH=/usr/local/pgsql-8.2/bin:$PATH:

# Optionally, set PGDATA to location of your data directory:
export PGDATA=$HOME/pgdata

Powered by JunebugWiki v0.0.28 Last edited by lanaer on February 11, 2007 11:04 PM (diff)
Version 9 (current) «olderversions