Skip to content

Commit 0cb4293

Browse files
Use trusted_server_config for app config defaults (#864)
1 parent 8fc46b0 commit 0cb4293

5 files changed

Lines changed: 16 additions & 18 deletions

File tree

crates/trusted-server-core/src/config_payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::error::TrustedServerError;
1212
use crate::settings::Settings;
1313

1414
/// Default config-store key containing the Trusted Server app-config blob.
15-
pub const CONFIG_BLOB_KEY: &str = "app_config";
15+
pub const CONFIG_BLOB_KEY: &str = "trusted_server_config";
1616

1717
/// Reconstruct validated [`Settings`] from a serialized config blob envelope.
1818
///

crates/trusted-server-core/src/settings_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::error::TrustedServerError;
88
use crate::platform::{PlatformConfigStore, StoreName};
99
use crate::settings::Settings;
1010

11-
const DEFAULT_CONFIG_STORE_ID: &str = "app_config";
11+
const DEFAULT_CONFIG_STORE_ID: &str = "trusted_server_config";
1212
const FASTLY_CHUNK_POINTER_KIND: &str = "fastly_config_chunks";
1313
const FASTLY_CONFIG_ENTRY_LIMIT: usize = 8_000;
1414

crates/trusted-server-integration-tests/fixtures/configs/viceroy-template.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
data = "test-api-key"
6868

6969
[local_server.config_stores]
70-
# Generated integration configs inject the app_config blob and the
71-
# empty trusted_server_config store required by the Fastly entry point.
70+
# Generated integration configs inject the trusted_server_config blob
71+
# into the store required by the Fastly entry point.
7272
# GENERATED_TRUSTED_SERVER_CONFIG_STORES
7373

7474
[local_server.config_stores.jwks_store]

crates/trusted-server-integration-tests/src/bin/generate-viceroy-config.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,10 @@ fn inject_generated_config_stores(template: &str, envelope_json: &str) -> Result
147147
fn generated_config_store_blocks(envelope_json: &str) -> String {
148148
format!(
149149
r#" # Generated by generate-viceroy-config. Do not edit generated output.
150-
[local_server.config_stores.app_config]
151-
format = "inline-toml"
152-
[local_server.config_stores.app_config.contents]
153-
app_config = '''{envelope_json}'''
154-
155-
# The post-cutover entry point still opens this store, but no longer
156-
# reads rollout flags from it.
157150
[local_server.config_stores.trusted_server_config]
158151
format = "inline-toml"
159-
[local_server.config_stores.trusted_server_config.contents]"#
152+
[local_server.config_stores.trusted_server_config.contents]
153+
trusted_server_config = '''{envelope_json}'''"#
160154
)
161155
}
162156

@@ -222,7 +216,7 @@ mod tests {
222216
.expect("should inject generated stores");
223217

224218
assert!(
225-
generated.contains("[local_server.config_stores.app_config]"),
219+
generated.contains("[local_server.config_stores.trusted_server_config]"),
226220
"should include app config store"
227221
);
228222
assert!(
@@ -246,11 +240,12 @@ mod tests {
246240
.expect("should inject generated stores");
247241
let parsed: toml::Value = toml::from_str(&generated).expect("should parse as TOML");
248242

249-
assert!(
243+
assert_eq!(
250244
parsed["local_server"]["config_stores"]["trusted_server_config"]["contents"]
251-
.as_table()
252-
.is_some_and(toml::Table::is_empty),
253-
"trusted_server_config should remain present with no rollout flags"
245+
["trusted_server_config"]
246+
.as_str(),
247+
Some(envelope.as_str()),
248+
"trusted_server_config should contain the app-config blob"
254249
);
255250
}
256251

crates/trusted-server-integration-tests/tests/environments/axum.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ impl RuntimeEnvironment for AxumDevServer {
3636

3737
let mut child = Command::new(&binary)
3838
.env("PORT", port.to_string())
39-
.env("TRUSTED_SERVER_CONFIG_APP_CONFIG_APP_CONFIG", app_config)
39+
.env(
40+
"TRUSTED_SERVER_CONFIG_TRUSTED_SERVER_CONFIG_TRUSTED_SERVER_CONFIG",
41+
app_config,
42+
)
4043
.stdout(Stdio::null())
4144
.stderr(Stdio::piped())
4245
.spawn()

0 commit comments

Comments
 (0)