summaryrefslogtreecommitdiff
path: root/config.h
blob: 9993680d6f1cd349f0ef8a53c6e80c8018412179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef CONFIG_H
#define CONFIG_H

typedef struct config_opt config_opt;
typedef enum config_type config_type;
typedef void (*config_func)(config_opt *, void *);

enum config_type {
	TYPE_INT,
	TYPE_STRING,
	TYPE_FLOAT,
	TYPE_BOOL,
};


struct config_opt {
	const char *name;	/* Name of the config option. */
	const char *desc;	/* Description of the config option. */
	config_type type;	/* Datatype of the config option. */
	config_func func;	/* Function of the config option. */
};

static const config_opt config_opts[] = {
	/* {"name", "desc", type, &func} */
	{"git-root", "Root of git server (can also be a url).", TYPE_STRING, &get_git_root},
	{"socket-type", "Socket type to use (options: unix, network. default: network).", TYPE_STRING, &get_sock_type},
	{"socket", "Path, IP address, or domain name of socket.", TYPE_STRING, &get_sock},
	{"port", "Port to listen on (network socket only).", TYPE_INT, &get_sock_port},
	{"merge-type", "Type of merge (options: 0 = Merge individually, 1 = Merge into one).", TYPE_INT, &get_merge_type},
	{"pr-root", "Directory to store pull requests in.", TYPE_STRING, &pr_root},
	{"key-file", "Path to file containing gpg/pgp public keys of each maintainer.", TYPE_STRING, &get_key_path},
};

extern config *parse_config(const char *filename);
#endif