Support multiple secret columns in SQL directories
Some checks failed
trivy / Check (push) Failing after -7m39s

This commit is contained in:
mdecimus 2024-08-10 09:10:27 +02:00
parent f18b1d2fd4
commit 8d3931b76e
3 changed files with 9 additions and 5 deletions

View file

@ -32,9 +32,9 @@ impl SqlDirectory {
.unwrap_or_default()
.to_string(),
column_secret: config
.value((&prefix, "columns.secret"))
.unwrap_or_default()
.to_string(),
.values((&prefix, "columns.secret"))
.map(|(_, v)| v.to_string())
.collect(),
column_quota: config
.value((&prefix, "columns.quota"))
.unwrap_or_default()

View file

@ -209,7 +209,11 @@ impl SqlMappings {
if let Some(row) = rows.rows.into_iter().next() {
for (name, value) in rows.names.into_iter().zip(row.values) {
if name.eq_ignore_ascii_case(&self.column_secret) {
if self
.column_secret
.iter()
.any(|c| name.eq_ignore_ascii_case(c))
{
if let Value::Text(secret) = value {
principal.secrets.push(secret.into_owned());
}

View file

@ -25,7 +25,7 @@ pub(crate) struct SqlMappings {
query_verify: String,
query_expand: String,
column_description: String,
column_secret: String,
column_secret: Vec<String>,
column_quota: String,
column_type: String,
}