Environmental variables

From CunningPlans

Jump to: navigation, search

Baldrick's behaviour on startup is controlled by several environmental variables, all of which are optional.

  • BALDRICK_WORKDIR - if defined, Baldrick will immediately chdir() to this directory. Any relative path defined in $BALDRICK_CONFIG_PATH is evaluted relative to $BALDRICK_WORKDIR.
    • Default: "." (the directory where baldrick-stub is installed.)
  • BALDRICK_CONFIG_PATH - The directory containing the configuration file $BALDRICK_CONFIG_FILE.
    • Default: "etc"
  • BALDRICK_CONFIG_FILE - the file to load, within the BALDRICK_CONFIG_PATH directory.
    • Default: "baldrick.cfg".

Environmental variables may be set in the Apache httpd.conf.

When running Baldrick as a CGI program, generally you won't need to set any of these. Simply make an "etc" directory in the same directory where you install baldrick-stub, and put the baldrick.cfg file within "etc". The default locations will point Baldrick's config file loader to this file. If the file must be somewhere else, try a symbolic link; or edit baldrick-stub to set environmental variables to appropriate values before the Baldrick libraries are loaded.

When using Apache mod_perl, however, the current working directory when the program is launched is generally not the cgi-bin directory, but rather the server root. You may place your "etc" configuration directory there if your hosting provider allows for it; but if not, the PerlSetEnv directive can set environmental variables allowing Baldrick to find its configuration file.

PerlSetEnv BALDRICK_WORKDIR /var/www/mysite.com/bin/
PerlSetEnv BALDRICK_CONFIG_PATH /var/www/mysite.com/bin/conf/
PerlSetEnv BALDRICK_CONFIG_FILE baldrick.cfg
Personal tools