]> the.earth.li Git - onak.git/blob - onak-conf.h
Add config option to specify keyd socket directory
[onak.git] / onak-conf.h
1 /**
2  * @file onak-conf.h
3  * @brief Routines related to runtime config.
4  *
5  * Copyright 2002 Jonathan McDowell <noodles@earth.li>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the Free
9  * Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, write to the Free Software Foundation, Inc., 51
18  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __ONAK_CONF_H_
22 #define __ONAK_CONF_H_
23
24 #include "keydb.h"
25
26 /**
27  * @brief Runtime configuration for onak.
28  *
29  * This structure holds various runtime configuration options for onak. It
30  * will eventually be populated from the config file.
31  */
32 struct onak_config {
33         /*
34          * Generic options.
35          */
36         /** The maximum number of keys a query should return. */
37         int maxkeys;
38         /** Our email address that servers sync with. */
39         char *thissite;
40         /** The email address of the server admin. */
41         char *adminemail;
42         /** The mta to invoke to send sync mails. */
43         char *mta;
44         /** List of email address for sites we sync with via email */
45         struct ll *syncsites;
46         /** A linked list of sites we sync with. */
47         char *logfile;
48
49         /** Set if we're using keyd as the backend. */
50         bool use_keyd;
51         /** The path to the directory the keyd socket lives in. */
52         char *sock_dir;
53
54         /*
55          * Options for any database backend that needs a directory, be it the
56          * file, fs or db4 options.
57          */
58         /** The path to the directory containing the database files. */
59         char *db_dir;
60         
61         /*
62          * Options for the Postgres backend.
63          */
64         /** The host that Postgres is running on. */
65         char *pg_dbhost;
66         /** The database name. */
67         char *pg_dbname;
68         /** The user we should connect as. */
69         char *pg_dbuser;
70         /** The password for the user. */
71         char *pg_dbpass;
72
73         /*
74          * Options for the dynamic backend.
75          */
76         /** Name of the DB backend we're using */
77         char *db_backend;
78         /** Directory where backend .so files can be found */
79         char *backends_dir;
80
81         /** Pointer to the initialisation function for our loaded DB backend */
82         struct onak_dbctx *(*dbinit)(bool);
83
84         /** Should we verify signature hashes match? */
85         bool check_sighash;
86 };
87
88 /**
89  * @brief The variable containing our runtime config.
90  */
91 extern struct onak_config config;
92
93 /**
94  * @brief read the onak config.
95  * @param configfile the config file to read.
96  *
97  * Read in our config file. If config file is NULL read in the compile
98  * time default.
99  */
100 void readconfig(const char *configfile);
101
102 /**
103  * @brief clean up the config when we're shutting down.
104  */
105 void cleanupconfig(void);
106
107 #endif /* __ONAK_CONF_H_ */