Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit d90737b

Browse files
feat(spin): conditionally load runtime config from root (#179)
Signed-off-by: Kate Goldenring <[email protected]>
1 parent 47aaea6 commit d90737b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

containerd-shim-spin/src/engine.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ use tokio::runtime::Runtime;
1717
use url::Url;
1818

1919
const SPIN_ADDR: &str = "0.0.0.0:80";
20+
/// RUNTIME_CONFIG_PATH specifies the expected location and name of the runtime
21+
/// config for a Spin application. The runtime config should be loaded into the
22+
/// root `/` of the container.
23+
const RUNTIME_CONFIG_PATH: &str = "/runtime-config.toml";
2024

2125
#[derive(Clone, Default)]
2226
pub struct SpinEngine;
@@ -145,7 +149,11 @@ impl SpinEngine {
145149

146150
// Build trigger config
147151
let loader = loader::TriggerLoader::new(working_dir.clone(), true);
148-
let runtime_config = RuntimeConfig::new(PathBuf::from("/").into());
152+
let mut runtime_config = RuntimeConfig::new(PathBuf::from("/").into());
153+
// Load in runtime config if one exists at expected location
154+
if Path::new(RUNTIME_CONFIG_PATH).exists() {
155+
runtime_config.merge_config_file(RUNTIME_CONFIG_PATH);
156+
}
149157
let mut builder = TriggerExecutorBuilder::new(loader);
150158
builder
151159
.hooks(StdioTriggerHook {})

0 commit comments

Comments
 (0)