File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,5 @@ 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
2323pub ( 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" ;
Original file line number Diff line number Diff line change 1- use std:: { collections:: HashSet , future:: Future , path:: Path , pin:: Pin } ;
1+ use std:: {
2+ collections:: HashSet ,
3+ future:: Future ,
4+ path:: { Path , PathBuf } ,
5+ pin:: Pin ,
6+ } ;
27
38use log:: info;
49use spin_app:: { locked:: LockedApp , App } ;
@@ -14,7 +19,7 @@ use trigger_command::CommandTrigger;
1419use trigger_mqtt:: MqttTrigger ;
1520use trigger_sqs:: SqsTrigger ;
1621
17- use crate :: constants:: { RUNTIME_CONFIG_PATH , SPIN_TRIGGER_WORKING_DIR } ;
22+ use crate :: constants:: { RUNTIME_CONFIG_PATH , SPIN_DEFAULT_STATE_DIR , SPIN_TRIGGER_WORKING_DIR } ;
1823
1924pub ( crate ) const HTTP_TRIGGER_TYPE : & str = <HttpTrigger as Trigger < TriggerFactors > >:: TYPE ;
2025pub ( crate ) const REDIS_TRIGGER_TYPE : & str = <RedisTrigger as Trigger < TriggerFactors > >:: TYPE ;
@@ -47,9 +52,13 @@ fn factors_config() -> FactorsConfig {
4752 let runtime_config_file = Path :: new ( RUNTIME_CONFIG_PATH )
4853 . exists ( )
4954 . then ( || RUNTIME_CONFIG_PATH . into ( ) ) ;
55+ // Configure the application state directory path. This is used in the default
56+ // locations for logs, key value stores, etc.
57+ let state_dir = PathBuf :: from ( SPIN_TRIGGER_WORKING_DIR ) . join ( SPIN_DEFAULT_STATE_DIR ) ;
5058 FactorsConfig {
5159 working_dir : SPIN_TRIGGER_WORKING_DIR . into ( ) ,
5260 runtime_config_file,
61+ state_dir : spin_trigger:: cli:: UserProvidedPath :: Provided ( state_dir) ,
5362 ..Default :: default ( )
5463 }
5564}
You can’t perform that action at this time.
0 commit comments