Skip to content

Commit 839c07c

Browse files
committed
fix: Set required config (to an empty value
Flask AppBuilder 5, for some reason, requires `RECAPTCHA_PUBLIC_KEY` to be set, or the UI cannot be used, and the following error is emitted on the container console: ``` File "/stackable/app/lib64/python3.11/site-packages/superset/views/base.py", line 417, in cached_common_bootstrap_data frontend_config["RECAPTCHA_PUBLIC_KEY"] = app.config["RECAPTCHA_PUBLIC_KEY"] ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'RECAPTCHA_PUBLIC_KEY' ```
1 parent d61e60b commit 839c07c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

rust/operator-binary/src/config.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ pub fn add_superset_config(
6161
SupersetConfigOptions::LoggingConfigurator.to_string(),
6262
"StackableLoggingConfigurator()".into(),
6363
);
64+
// Flask AppBuilder requires this to be set, otherwise the web ui cannot be used.
65+
// We chose to make it an expression in case the user wants to override it through
66+
// configurationOverrides (though it would require other settings like the private key too).
67+
config.insert(
68+
SupersetConfigOptions::RecaptchaPublicKey.to_string(),
69+
"''".to_owned(),
70+
);
6471

6572
append_authentication_config(config, authentication_config)?;
6673

rust/operator-binary/src/crd/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ pub enum SupersetConfigOptions {
110110
AuthOpaRule,
111111
AuthOpaCacheMaxEntries,
112112
AuthOpaCacheTtlInSec,
113+
// Flask AppBuilder (currently) requires this to be set, even if not used,
114+
// otherwise the web UI cannot be used,
115+
RecaptchaPublicKey,
113116
}
114117

115118
#[versioned(
@@ -425,6 +428,11 @@ impl FlaskAppConfigOptions for SupersetConfigOptions {
425428
SupersetConfigOptions::AuthOpaRule => PythonType::StringLiteral,
426429
SupersetConfigOptions::AuthOpaCacheMaxEntries => PythonType::IntLiteral,
427430
SupersetConfigOptions::AuthOpaCacheTtlInSec => PythonType::IntLiteral,
431+
// Flask AppBuilder (currently) requires this option to be set (even if empty).
432+
// If we set it to a string, the user cannot then get it from an expression in
433+
// configOverrides. So we make it an expression, but will need to manually quote the
434+
// empty string as a default.
435+
SupersetConfigOptions::RecaptchaPublicKey => PythonType::Expression,
428436
}
429437
}
430438
}

0 commit comments

Comments
 (0)