2026-02-27 04:29:51 +00:00
use serde ::{ Deserialize , Serialize } ;
2026-03-01 01:21:33 +00:00
use super ::project ::EnvVar ;
2026-02-28 21:18:33 +00:00
fn default_true ( ) -> bool {
true
}
2026-03-01 01:21:33 +00:00
fn default_global_instructions ( ) -> Option < String > {
Some ( " If the project is not initialized with git, recommend to the user to initialize and use git to track changes. This makes it easier to revert should something break. " . to_string ( ) )
}
2026-02-27 15:22:49 +00:00
#[ derive(Debug, Clone, Serialize, Deserialize, PartialEq) ]
#[ serde(rename_all = " snake_case " ) ]
pub enum ImageSource {
Registry ,
LocalBuild ,
Custom ,
}
impl Default for ImageSource {
fn default ( ) -> Self {
Self ::Registry
}
}
#[ derive(Debug, Clone, Serialize, Deserialize) ]
pub struct GlobalAwsSettings {
#[ serde(default) ]
pub aws_config_path : Option < String > ,
#[ serde(default) ]
pub aws_profile : Option < String > ,
#[ serde(default) ]
pub aws_region : Option < String > ,
}
impl Default for GlobalAwsSettings {
fn default ( ) -> Self {
Self {
aws_config_path : None ,
aws_profile : None ,
aws_region : None ,
}
}
}
2026-02-27 04:29:51 +00:00
#[ derive(Debug, Clone, Serialize, Deserialize) ]
pub struct AppSettings {
2026-02-27 15:22:49 +00:00
#[ serde(default) ]
2026-02-27 04:29:51 +00:00
pub default_ssh_key_path : Option < String > ,
2026-02-27 15:22:49 +00:00
#[ serde(default) ]
2026-02-27 04:29:51 +00:00
pub default_git_user_name : Option < String > ,
2026-02-27 15:22:49 +00:00
#[ serde(default) ]
2026-02-27 04:29:51 +00:00
pub default_git_user_email : Option < String > ,
2026-02-27 15:22:49 +00:00
#[ serde(default) ]
2026-02-27 04:29:51 +00:00
pub docker_socket_path : Option < String > ,
2026-02-27 15:22:49 +00:00
#[ serde(default) ]
pub image_source : ImageSource ,
#[ serde(default) ]
pub custom_image_name : Option < String > ,
#[ serde(default) ]
pub global_aws : GlobalAwsSettings ,
2026-03-01 01:21:33 +00:00
#[ serde(default = " default_global_instructions " ) ]
2026-02-27 18:39:20 -08:00
pub global_claude_instructions : Option < String > ,
2026-03-01 01:21:33 +00:00
#[ serde(default) ]
pub global_custom_env_vars : Vec < EnvVar > ,
2026-02-28 21:18:33 +00:00
#[ serde(default = " default_true " ) ]
pub auto_check_updates : bool ,
#[ serde(default) ]
pub dismissed_update_version : Option < String > ,
2026-02-27 04:29:51 +00:00
}
impl Default for AppSettings {
fn default ( ) -> Self {
Self {
default_ssh_key_path : None ,
default_git_user_name : None ,
default_git_user_email : None ,
docker_socket_path : None ,
2026-02-27 15:22:49 +00:00
image_source : ImageSource ::default ( ) ,
custom_image_name : None ,
global_aws : GlobalAwsSettings ::default ( ) ,
2026-03-01 01:21:33 +00:00
global_claude_instructions : default_global_instructions ( ) ,
global_custom_env_vars : Vec ::new ( ) ,
2026-02-28 21:18:33 +00:00
auto_check_updates : true ,
dismissed_update_version : None ,
2026-02-27 04:29:51 +00:00
}
}
}