Don't require pgaudit library in local tests

This commit is contained in:
Anastasia Lubennikova
2025-05-05 15:10:29 +01:00
parent 664a3e0953
commit 807e00e9d2

View File

@@ -171,15 +171,17 @@ pub fn write_postgres_conf(
// Always add pgaudit to shared_preload_libraries.
//
// This is needed to handle the downgrade scenario.
// pgaudit extension once installed
// will not be removed when audit_log_level is set to disabled,
// and it creates event triggers that require library to be loaded.
// pgaudit extension creates event triggers that require library to be loaded.
// so, once extension was installed it must always be present in shared_preload_libraries.
let mut extra_shared_preload_libraries = String::new();
let libs = spec
.cluster
.settings
.find("shared_preload_libraries")
.expect("shared_preload_libraries setting is missing in the spec");
// We don't distribute pgaudit in the testing image,
// so disable this logic there.
#[cfg(not(feature = "testing"))]
if !libs.contains("pgaudit") {
extra_shared_preload_libraries.push_str(",pgaudit");
};