mirror of
https://github.com/matter-labs/teepot.git
synced 2025-07-21 07:03:56 +02:00
feat(tdx-google): enhance container service setup
- Add `vector.service` and `chronyd.service` dependencies to `docker_start_container` service. - Use `EnvironmentFile` and a pre-start script to dynamically generate environment variables for container setup. - Improve error handling and clarity in container initialization.
This commit is contained in:
parent
908579cd60
commit
a41460b7f0
3 changed files with 50 additions and 28 deletions
|
@ -170,27 +170,35 @@ fn protocol_from_string(protocol: &str) -> Result<opentelemetry_otlp::Protocol,
|
|||
pub async fn load_config_with_telemetry<
|
||||
S: Default + Serialize + for<'a> Deserialize<'a> + Send + 'static,
|
||||
>(
|
||||
env_prefix: String,
|
||||
get_telemetry_config: fn(&S) -> &TelemetryConfig,
|
||||
) -> Result<S, Box<dyn std::error::Error + Send + Sync>> {
|
||||
with_console_logging(async move {
|
||||
trace!("Loading config");
|
||||
// Load configuration
|
||||
let config = ConfigBuilder::<AsyncState>::default()
|
||||
.add_source(Config::try_from(&S::default())?)
|
||||
.add_source(File::with_name("config/default").required(false))
|
||||
.add_source(
|
||||
config::Environment::with_prefix("APP")
|
||||
.try_parsing(true)
|
||||
.separator("_"),
|
||||
)
|
||||
.add_async_source(HttpSource {
|
||||
uri: DEFAULT_INSTANCE_METADATA_BASE_URL.into(),
|
||||
format: FileFormat::Json,
|
||||
required: false,
|
||||
})
|
||||
.build()
|
||||
.await?
|
||||
.try_deserialize::<S>()?;
|
||||
let config = {
|
||||
let c = ConfigBuilder::<AsyncState>::default()
|
||||
.add_source(Config::try_from(&S::default())?)
|
||||
.add_source(File::with_name("config/default").required(false))
|
||||
.add_source(
|
||||
config::Environment::with_prefix(&env_prefix)
|
||||
.try_parsing(true)
|
||||
.separator("_"),
|
||||
);
|
||||
|
||||
if std::env::var_os("GOOGLE_METADATA").is_some() {
|
||||
c.add_async_source(HttpSource {
|
||||
uri: DEFAULT_INSTANCE_METADATA_BASE_URL.into(),
|
||||
format: FileFormat::Json,
|
||||
required: false,
|
||||
})
|
||||
.build()
|
||||
.await?
|
||||
.try_deserialize::<S>()?
|
||||
} else {
|
||||
c.build().await?.try_deserialize::<S>()?
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize telemetry
|
||||
init_telemetry(get_telemetry_config(&config))?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue