-
Notifications
You must be signed in to change notification settings - Fork 12
Honor EdgeZero app config store default #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0be62bf
ef1477f
7c3d054
81adefc
e2637d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,36 @@ | ||
| use std::env; | ||
| use std::path::PathBuf; | ||
|
|
||
| use edgezero_core::manifest::ManifestLoader; | ||
|
|
||
| fn main() { | ||
| println!("cargo:rerun-if-changed=build.rs"); | ||
|
|
||
| // Keep every adapter's compiled default synchronized with the repository manifest. | ||
| let manifest_path = PathBuf::from( | ||
| env::var("CARGO_MANIFEST_DIR").expect("should receive CARGO_MANIFEST_DIR from Cargo"), | ||
| ) | ||
| .join("../..") | ||
| .join("edgezero.toml"); | ||
| println!("cargo:rerun-if-changed={}", manifest_path.display()); | ||
|
|
||
| let manifest = match ManifestLoader::from_path(&manifest_path) { | ||
| Ok(manifest) => manifest, | ||
| Err(error) => { | ||
| println!( | ||
|
ChristianPavilonis marked this conversation as resolved.
|
||
| "cargo::error=should load EdgeZero manifest at {}: {error}", | ||
| manifest_path.display() | ||
| ); | ||
| std::process::exit(1); | ||
| } | ||
| }; | ||
| let Some(config_store) = manifest.manifest().stores.config.as_ref() else { | ||
| println!( | ||
| "cargo::error=should declare [stores.config] in EdgeZero manifest at {}", | ||
| manifest_path.display() | ||
| ); | ||
| std::process::exit(1); | ||
| }; | ||
| let default_store_id = config_store.default_id(); | ||
| println!("cargo:rustc-env=TRUSTED_SERVER_DEFAULT_CONFIG_STORE_ID={default_store_id}"); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,8 +11,13 @@ use error_stack::Report; | |||||||||||||||||||
| use crate::error::TrustedServerError; | ||||||||||||||||||||
| use crate::settings::Settings; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /// Default logical config-store id, from `[stores.config].default` in `edgezero.toml`. | ||||||||||||||||||||
| /// | ||||||||||||||||||||
|
ChristianPavilonis marked this conversation as resolved.
|
||||||||||||||||||||
| /// Derived at build time so every adapter uses the repository manifest's default. | ||||||||||||||||||||
| pub const DEFAULT_CONFIG_STORE_ID: &str = env!("TRUSTED_SERVER_DEFAULT_CONFIG_STORE_ID"); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /// Default config-store key containing the Trusted Server app-config blob. | ||||||||||||||||||||
| pub const CONFIG_BLOB_KEY: &str = "trusted_server_config"; | ||||||||||||||||||||
| pub const CONFIG_BLOB_KEY: &str = DEFAULT_CONFIG_STORE_ID; | ||||||||||||||||||||
|
ChristianPavilonis marked this conversation as resolved.
Comment on lines
19
to
+20
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 thinking —
Suggested change
(Verified in a scratch worktree at this head: |
||||||||||||||||||||
|
|
||||||||||||||||||||
| /// Reconstruct validated [`Settings`] from a serialized config blob envelope. | ||||||||||||||||||||
| /// | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.