Skip to content

Commit f0ddeba

Browse files
fix: enable configuring state_dir with runtime configuration
Signed-off-by: Kate Goldenring <[email protected]>
1 parent e25bd7d commit f0ddeba

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

containerd-shim-spin/src/constants.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ pub(crate) const SPIN_TRIGGER_WORKING_DIR: &str = "/";
2121
/// Defines the subset of application components that should be executable by the shim
2222
/// If empty or DNE, all components will be supported
2323
pub(crate) const SPIN_COMPONENTS_TO_RETAIN_ENV: &str = "SPIN_COMPONENTS_TO_RETAIN";
24-
/// The default state directory for the triggers.
25-
pub(crate) const SPIN_DEFAULT_STATE_DIR: &str = ".spin";

containerd-shim-spin/src/trigger.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
use std::{
2-
collections::HashSet,
3-
future::Future,
4-
path::{Path, PathBuf},
5-
pin::Pin,
6-
};
1+
use std::{collections::HashSet, future::Future, path::Path, pin::Pin};
72

83
use log::info;
94
use spin_app::{locked::LockedApp, App};
@@ -19,7 +14,7 @@ use trigger_command::CommandTrigger;
1914
use trigger_mqtt::MqttTrigger;
2015
use trigger_sqs::SqsTrigger;
2116

22-
use crate::constants::{RUNTIME_CONFIG_PATH, SPIN_DEFAULT_STATE_DIR, SPIN_TRIGGER_WORKING_DIR};
17+
use crate::constants::{RUNTIME_CONFIG_PATH, SPIN_TRIGGER_WORKING_DIR};
2318

2419
pub(crate) const HTTP_TRIGGER_TYPE: &str = <HttpTrigger as Trigger<TriggerFactors>>::TYPE;
2520
pub(crate) const REDIS_TRIGGER_TYPE: &str = <RedisTrigger as Trigger<TriggerFactors>>::TYPE;
@@ -54,11 +49,10 @@ fn factors_config() -> FactorsConfig {
5449
.then(|| RUNTIME_CONFIG_PATH.into());
5550
// Configure the application state directory path. This is used in the default
5651
// locations for logs, key value stores, etc.
57-
let state_dir = PathBuf::from(SPIN_TRIGGER_WORKING_DIR).join(SPIN_DEFAULT_STATE_DIR);
5852
FactorsConfig {
5953
working_dir: SPIN_TRIGGER_WORKING_DIR.into(),
6054
runtime_config_file,
61-
state_dir: UserProvidedPath::Provided(state_dir),
55+
local_app_dir: Some(SPIN_TRIGGER_WORKING_DIR.to_string()),
6256
// Explicitly do not set log dir in order to force logs to be displayed to stdout.
6357
// Otherwise, would default to the state directory.
6458
log_dir: UserProvidedPath::Unset,

0 commit comments

Comments
 (0)