There are a number of options (including a new table on your db), but the one that could best fit your scenario is to use an environment variable.
An environment variable can easily be updated by an admin and will be available to your app right after been updated.
Setting environment variable
Add this line to /.bash_profile
(in Mac OS X) and /etc/environment
(in Ubuntu):
export MY_VARIABLE=VALUE
Where MY_VARIABLE
is the name of your variable and VALUE
is its value.
Getting values from environment variable
Anywhere in your rails app you can access the environment variable with ENV["MY_VARIABLE"]
, for example:
my_env_variable = ENV["MY_VARIABLE"]
Answer for additional questions
where this env vars are saved?
.bash_profile
and /etc/environment
files.
How can I override them for example from controller?
You should be able to change its value with
ENV["MY_VARIABLE"] = new_value
but i recommend against it, you will lose the advantage of using env variables.
How long are they kept?
As long as they remain specified in .bash_profile
and /etc/environment
files.
Deploy affect theme?
No.
How can I view list of env vars?
Run this command:
$ printenv