3 * @brief Routines related to runtime config.
5 * Copyright 2002 Jonathan McDowell <noodles@earth.li>
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.
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
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <https://www.gnu.org/licenses/>.
20 #ifndef __ONAK_CONF_H_
21 #define __ONAK_CONF_H_
28 * @brief Backend database configuration.
31 struct onak_db_config {
32 /** Name, as used to refer to individual backend instances */
34 /** Backend type [e.g. db4, pg, fs, file] */
36 /** Location information; directory for file backed, DB name for DBs */
38 /** Database backend hostname, if appropriate */
40 /** Database backend username, if appropriate */
42 /** Database backend password, if appropriate */
47 * @brief Runtime configuration for onak.
49 * This structure holds various runtime configuration options for onak. It
50 * will eventually be populated from the config file.
56 /** The maximum number of keys a query should return. */
58 /** Our email address that servers sync with. */
60 /** The email address of the server admin. */
62 /** The mta to invoke to send sync mails. */
64 /** List of email address for sites we sync with via email */
66 /** A linked list of sites we sync with. */
69 /** Set if we're using keyd as the backend. */
71 /** The path to the directory the keyd socket lives in. */
74 /** List of backend configurations */
77 /* The default backend to use */
78 struct onak_db_config *backend;
81 * Options for the dynamic backend.
83 /** Name of the DB backend we're using */
85 /** Directory where backend .so files can be found */
88 /** Pointer to the initialisation function for our loaded DB backend */
89 struct onak_dbctx *(*dbinit)(struct onak_db_config *, bool);
91 /** Should we verify signature hashes match? */
95 * Options used by the email handling script.
96 * None of the C code uses this information, but we should be able
99 /** Location of the onak binary, so the mail script can find it. */
101 /** Where incoming mail gets queue, one file per mail. */
106 * @brief The variable containing our runtime config.
108 extern struct onak_config config;
111 * @brief read the onak config.
112 * @param configfile the config file to read.
114 * Read in our config file. If config file is NULL read in the compile
117 void readconfig(const char *configfile);
120 * @brief write the onak config.
121 * @param configfile the config file to write to.
123 * Write out the config file. If config file is NULL write it to STDOUT.
125 void writeconfig(const char *configfile);
128 * @brief clean up the config when we're shutting down.
130 void cleanupconfig(void);
134 * @brief Find a specified backend configuration by name.
136 struct onak_db_config *find_db_backend_config(struct ll *backends, char *name);
138 #endif /* __ONAK_CONF_H_ */