Skip to content

Commit 031bdaa

Browse files
authored
Try to load metastore from ENV if no config file is specified (#84)
1 parent 27ab196 commit 031bdaa

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

crates/api-snowflake-rest/src/server/core_state.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct CoreState {
2424
pub enum MetastoreConfig {
2525
ConfigPath(PathBuf),
2626
ConfigJson(String),
27+
Env,
2728
DefaultConfig,
2829
None,
2930
}
@@ -70,6 +71,14 @@ async fn apply_metastore_bootstrap_config(
7071
metastore_bootstrap_config: MetastoreConfig,
7172
) -> Result<()> {
7273
match metastore_bootstrap_config {
74+
MetastoreConfig::Env => {
75+
tracing::info!("Bootstrapping metastore from environment");
76+
let config = MetastoreBootstrapConfig::load_from_env().context(MetastoreConfigSnafu)?;
77+
config
78+
.apply(metastore.clone())
79+
.await
80+
.context(MetastoreConfigSnafu)?;
81+
}
7382
MetastoreConfig::ConfigPath(path) => {
7483
tracing::info!(
7584
path = %path.display(),

crates/embucket-lambda/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl LambdaApp {
8585
let metastore_cfg = if let Some(config_path) = &config.metastore_config {
8686
MetastoreConfig::ConfigPath(config_path.clone())
8787
} else {
88-
MetastoreConfig::None
88+
MetastoreConfig::Env
8989
};
9090

9191
let metastore_settings_config = MetastoreSettingsConfig::default()

crates/embucketd/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async fn async_main(
141141
let metastore_cfg = if let Some(config_path) = &opts.metastore_config {
142142
MetastoreConfig::ConfigPath(config_path.clone())
143143
} else {
144-
MetastoreConfig::None
144+
MetastoreConfig::Env
145145
};
146146
let core_state = CoreState::new(
147147
execution_cfg,

0 commit comments

Comments
 (0)