aboutsummaryrefslogtreecommitdiff
path: root/config.h
blob: d1f31a8398e20d4425a6016130f42812e321dd95 (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
#pragma once

#include <stdbool.h>

/* Config file format
 *
 * Each line is a command that modifies some part of the configuration. A line
 * starting with a '#' is a comment and is ignored. The available commands are
 * as follows:
 * - 'apikey': the line contains three space-separated fields: 'apikey', the
 *   key itself, and a permission bit vector (string of 0/1 characters). The
 *   permission bit vector has the following elements:
 *   1. Whether 'sendat' is allowed.
 */


// Writes to stderr and exits on failure.
void config_init(const char *filename);

// Permissions for a particular API key
struct apikey_perm {
	bool sendat;
};

struct apikey_perm config_check_apikey(const char *apikey);