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_
29 * @brief Backend database configuration.
32 struct onak_db_config {
33 /** Name, as used to refer to individual backend instances */
35 /** Backend type [e.g. db4, pg, fs, file] */
37 /** Location information; directory for file backed, DB name for DBs */
39 /** Database backend hostname, if appropriate */
41 /** Database backend username, if appropriate */
43 /** Database backend password, if appropriate */
48 * @brief Runtime configuration for onak.
50 * This structure holds various runtime configuration options for onak. It
51 * will eventually be populated from the config file.
57 /** The maximum number of keys a query should return. */
59 /** Our email address that servers sync with. */
61 /** The email address of the server admin. */
63 /** The mta to invoke to send sync mails. */
65 /** List of email address for sites we sync with via email */
67 /** A linked list of sites we sync with. */
70 /** Set if we're using keyd as the backend. */
72 /** The path to the directory the keyd socket lives in. */
75 /** List of backend configurations */
78 /* The default backend to use */
79 struct onak_db_config *backend;
82 * Options for the dynamic backend.
84 /** Name of the DB backend we're using */
86 /** Directory where backend .so files can be found */
89 /** Pointer to the initialisation function for our loaded DB backend */
90 struct onak_dbctx *(*dbinit)(struct onak_db_config *, bool);
92 /** What policies should we use for cleaning keys? */
93 uint64_t clean_policies;
96 * Options used by the email handling script.
97 * None of the C code uses this information, but we should be able
100 /** Location of the onak binary, so the mail script can find it. */
102 /** Where incoming mail gets queue, one file per mail. */
107 * @brief The variable containing our runtime config.
109 extern struct onak_config config;
112 * @brief read the onak config.
113 * @param configfile the config file to read.
115 * Read in our config file. If config file is NULL read in the compile
118 void readconfig(const char *configfile);
121 * @brief write the onak config.
122 * @param configfile the config file to write to.
124 * Write out the config file. If config file is NULL write it to STDOUT.
126 void writeconfig(const char *configfile);
129 * @brief clean up the config when we're shutting down.
131 void cleanupconfig(void);
135 * @brief Find a specified backend configuration by name.
137 struct onak_db_config *find_db_backend_config(struct ll *backends, char *name);
139 #endif /* __ONAK_CONF_H_ */