Move loadConfFile() to initLibStore

Part of an effort to make it easier to initialize the right things,
by moving code into the appropriate libraries.

Using libstore without loading the config file is risky, as sqlite
may then be misconfigured. See https://github.com/cachix/cachix/issues/475
This commit is contained in:
Robert Hensing 2023-02-01 16:46:26 +01:00
parent 6e0b7109ab
commit a692c43729
3 changed files with 3 additions and 3 deletions

View file

@ -27,7 +27,6 @@ static ref<Store> store()
if (!_store) {
try {
initLibStore();
loadConfFile();
settings.lockCPU = false;
_store = openStore();
} catch (Error & e) {

View file

@ -166,8 +166,6 @@ void initNix()
if (sodium_init() == -1)
throw Error("could not initialise libsodium");
loadConfFile();
startSignalHandlerThread();
/* Reset SIGCHLD to its default. */

View file

@ -291,6 +291,9 @@ void assertLibStoreInitialized() {
}
void initLibStore() {
loadConfFile();
initLibStoreDone = true;
}