/database/configuration.c
/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
 * BSD-style license.  Please see the COPYING file for details.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "configuration.h"
#include "config.h"

struct blerg_configuration blergconf;

int blerg_configuration_init() {
	char *a;

	a = getenv("BLERG_PATH");
	if (a == NULL) {
		strncpy(blergconf.base_path, BLERG_PATH, FILENAME_MAX);
	} else {
		strncpy(blergconf.base_path, a, FILENAME_MAX);
	}

	snprintf(blergconf.data_path, FILENAME_MAX, "%s/%s", blergconf.base_path, DATA_PATH);
	snprintf(blergconf.hash_tags_path, FILENAME_MAX, "%s/%s", blergconf.base_path, HASH_TAGS_PATH);
	snprintf(blergconf.ref_tags_path, FILENAME_MAX, "%s/%s", blergconf.base_path, REF_TAGS_PATH);

	return 1;
}