Several files that a camp ends up using are dynamically generated when the camp is created. An example is catalog_local.cfg. It is not kept in source control and contains several variables which are different depending on which camp it is located in. These files are located in:
/home/camp/basic/etc
The files, direcetories, and their subdirectories in this directory mirror their counterparts in the ~/campXX which will be their eventual destination. For example:
/home/camp/basic/etc/catalogs/fnet/catalog_local.cfg
is the template for
~/campXX/catalogs/fnet/catalog_local.cfgThe "variables" in the tamplates work much the same way as interchange variables and can be written in using __CAMP_VARIABLE__. These will get replaced by their respective values when the camp is created.
Some of these values are set by the code in Camp::Master (which is
located in /home/camp/lib/Camp/Master.pm). Others
can be set in the
perldoc /home/camp/lib/Camp/Master.pm
The copy_paths.yml file is used to set up files and directories that need to be tacked into the camp, but whose source is not the version control repository. The images/photos directory is an example. Once the main source tree is checked out, the camp builder creates a symlink to the images/photos directory from the canonical one (in /usr/local/fnet).
The file is located in /home/camp/basic/copy_paths.yml.
As above more detail documentation and examples can be found in the perl documentation for Camp::Master
Camp::Config provides access to camp specific resources from perl scripts. It allows you to create perl scripts which are independant of hardcoded paths, database handles, etc. Detailed documentation and examples are found in the perl documentation.
perldoc /home/camp/lib/Camp/ConfigFor a particular catalog type a global library is put into the perl path so it can be accessed from anywhere on the system. For the fnet catalog it is FNet::Config. The file is placeed at /usr/local/lib/perl5/site_perl/5.8.5/FNet/Config.pm. On the 64-bit OS installed machines it is located at /usr/local/lib/perl5/site_perl/5.8.8/FNet/Config.pm.
To use in a script, you include the module and create a new config instance.
use FNet::Config;
my $config = FNet::Config->new();
The resulting $config object can be used according to the docs for Camp::Config.
The script mysql-dump will create a dump of the live production database for use by the camps. In practice, this will be run from cron a couple of times a day when the camps are active. It may still be interesting to manually update it occasionally. The script is located at:
/home/camp/basic/bin
Once you run this, then run refresh-camp --db inside your camp to pull the most recent version of the database into it.
To an extremely limited degree, the camp environment can be pulled into shell scripts as well. To use, add the following to your shell script:
. /home/camp/bin/parse_fnet_config.sh
This will pull some camp variables in as shell environment variables. These are all prefaced with CAMP_ and can be accessed the same as any environment variables in the script. The variables currently exported are:
Normal Interchange variables can be added to the exported list by adding them to the env_variables call in parse_fnet_config.sh. Programatically determined aspects of the camp will have to be added by modifying the env_variables subroutine in Camp::Config.