User Tools

Site Tools


server:running_the_server:environment_variables

Crossfire Server Environment Variables

The crossfire server recognizes the following environmental variables;
these should correspond to their positional parameters counterparts, and be overridden by those.

  • CROSSFIRE_LIBDIR -data ( /absolute/path/to/share/crossfire directory )
  • CROSSFIRE_LOCALDIR -localdir ( /absolute/path/to/var/crossfire directory )
  • CROSSFIRE_PLAYERDIR -playerdir ( relative/path/to/players dir inside LOCALDIR directory )
  • CROSSFIRE_MAPDIR -maps ( relative/path/to/maps dir inside LIBDIR directory )
  • CROSSFIRE_ARCHETYPES -arch ( relative/path/to/archetypes file inside LIBDIR directory :!: the arch/ directory has not some env variable nor parameter )
  • CROSSFIRE_TREASURES -treasures ( relative/path/to/treasures file inside LIBDIR directory )
  • CROSSFIRE_UNIQUEDIR -uniquedir ( relative/path/to/unique-items dir inside LOCALDIR directory )
  • CROSSFIRE_TEMPLATEDIR -templatedir ( relative/path/to/template-maps dir inside LOCALDIR directory )
  • CROSSFIRE_TMPDIR -tmpdir ( /absolute/path/to/tmp directory )

From server/common/init.c :

/** init_environ initializes values from the environmental variables.
 * it needs to be called very early, since command line options should
 * overwrite these if specified.
 */
void init_environ(void) {
    char *cp;
 
    cp=getenv("CROSSFIRE_LIBDIR");
    if (cp) settings.datadir=cp;
    cp=getenv("CROSSFIRE_LOCALDIR");
    if (cp) settings.localdir=cp;
    cp=getenv("CROSSFIRE_PLAYERDIR");
    if (cp) settings.playerdir=cp;
    cp=getenv("CROSSFIRE_MAPDIR");
    if (cp) settings.mapdir=cp;
    cp=getenv("CROSSFIRE_ARCHETYPES");
    if (cp) settings.archetypes=cp;
    cp=getenv("CROSSFIRE_TREASURES");
    if (cp) settings.treasures=cp;
    cp=getenv("CROSSFIRE_UNIQUEDIR");
    if (cp) settings.uniquedir=cp;
    cp=getenv("CROSSFIRE_TEMPLATEDIR");
    if (cp) settings.templatedir=cp;
    cp=getenv("CROSSFIRE_TMPDIR");
    if (cp) settings.tmpdir=cp;
}
server/running_the_server/environment_variables.txt · Last modified: 2018/02/28 05:05 by karl