Add container registry pull, image source settings, and global AWS config
All checks were successful
Build Container / build-container (push) Successful in 1m59s
All checks were successful
Build Container / build-container (push) Successful in 1m59s
Support pulling images from registry (default: repo.anhonesthost.net/cybercovellc/triple-c/triple-c-sandbox:latest), local builds, or custom images via a new settings UI. Add global AWS configuration (config path auto-detect, profile picker, region) that serves as defaults overridable per-project for Bedrock auth. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,55 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AppSettings {
|
||||
#[serde(default)]
|
||||
pub default_ssh_key_path: Option<String>,
|
||||
#[serde(default)]
|
||||
pub default_git_user_name: Option<String>,
|
||||
#[serde(default)]
|
||||
pub default_git_user_email: Option<String>,
|
||||
#[serde(default)]
|
||||
pub docker_socket_path: Option<String>,
|
||||
#[serde(default)]
|
||||
pub image_source: ImageSource,
|
||||
#[serde(default)]
|
||||
pub custom_image_name: Option<String>,
|
||||
#[serde(default)]
|
||||
pub global_aws: GlobalAwsSettings,
|
||||
}
|
||||
|
||||
impl Default for AppSettings {
|
||||
@@ -15,6 +59,9 @@ impl Default for AppSettings {
|
||||
default_git_user_name: None,
|
||||
default_git_user_email: None,
|
||||
docker_socket_path: None,
|
||||
image_source: ImageSource::default(),
|
||||
custom_image_name: None,
|
||||
global_aws: GlobalAwsSettings::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::app_settings::ImageSource;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ContainerInfo {
|
||||
pub container_id: String,
|
||||
@@ -8,9 +10,22 @@ pub struct ContainerInfo {
|
||||
pub image: String,
|
||||
}
|
||||
|
||||
pub const IMAGE_NAME: &str = "triple-c";
|
||||
pub const LOCAL_IMAGE_NAME: &str = "triple-c";
|
||||
pub const IMAGE_TAG: &str = "latest";
|
||||
pub const REGISTRY_IMAGE: &str = "repo.anhonesthost.net/cybercovellc/triple-c/triple-c-sandbox:latest";
|
||||
|
||||
pub fn full_image_name() -> String {
|
||||
format!("{IMAGE_NAME}:{IMAGE_TAG}")
|
||||
pub fn local_build_image_name() -> String {
|
||||
format!("{LOCAL_IMAGE_NAME}:{IMAGE_TAG}")
|
||||
}
|
||||
|
||||
pub fn resolve_image_name(source: &ImageSource, custom: &Option<String>) -> String {
|
||||
match source {
|
||||
ImageSource::Registry => REGISTRY_IMAGE.to_string(),
|
||||
ImageSource::LocalBuild => local_build_image_name(),
|
||||
ImageSource::Custom => custom
|
||||
.as_deref()
|
||||
.filter(|s| !s.is_empty())
|
||||
.unwrap_or(REGISTRY_IMAGE)
|
||||
.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user