C
Carl Youngblood
I'm trying to use Daniel Berger's handy database connection abstraction
layer called DBI:BRC. One of its requirements is the the user that
the calling script is run under must have exclusive access to the DB
connection/password file. This file must be in the user's home
directory. However, my scripts are running as the apache user, which
happens to be called apache on default red hat 9 installations, which
I'm running on. Apache's home dir is in /var/www on RH9. DBRC is
looking for this directory in ENV['HOME'], but this environment variable
is not set when I run my ruby scripts under Apache/mod_fastcgi.
Fine, I thought, I'll just add a directive to my Apache conf to set the
environment right (SetEnv, to be precise). However, that didn't seem to
change anything. I suspect it is because mod_fastcgi runs in a slightly
different environment than regular Apache. Don't know. Anyway, two
kludgey ways of knowing where to save the DBRC file that I can think of are:
- Calling `echo ~` still works. I could add this to dbrc.rb. But
spawning a shell command seems kind of gross for this.
- Or just hard coding it in dbrc.rb, which seems equally gross, and also
the home directory may be different on the server that I deploy this
app on.
Does anybody have an idea of how I can get my ruby/fastcgi scripts to
see regular environment vars?
Thanks,
Carl
layer called DBI:BRC. One of its requirements is the the user that
the calling script is run under must have exclusive access to the DB
connection/password file. This file must be in the user's home
directory. However, my scripts are running as the apache user, which
happens to be called apache on default red hat 9 installations, which
I'm running on. Apache's home dir is in /var/www on RH9. DBRC is
looking for this directory in ENV['HOME'], but this environment variable
is not set when I run my ruby scripts under Apache/mod_fastcgi.
Fine, I thought, I'll just add a directive to my Apache conf to set the
environment right (SetEnv, to be precise). However, that didn't seem to
change anything. I suspect it is because mod_fastcgi runs in a slightly
different environment than regular Apache. Don't know. Anyway, two
kludgey ways of knowing where to save the DBRC file that I can think of are:
- Calling `echo ~` still works. I could add this to dbrc.rb. But
spawning a shell command seems kind of gross for this.
- Or just hard coding it in dbrc.rb, which seems equally gross, and also
the home directory may be different on the server that I deploy this
app on.
Does anybody have an idea of how I can get my ruby/fastcgi scripts to
see regular environment vars?
Thanks,
Carl