4 files changed
+13
-13
.smb/config.toml
+2
-2
@@ -1,6 +1,6 @@
1
name = 'smbCloud CLI'
2
description = 'smbCloud CLI monorepo'
3
4
-[repository]
4
+[project]
5
id = 1
6
-name = 'smbcloudcli'
6
+repository = 'smbcloudcli'
crates/cli/src/deploy/config.rs
+4
-4
@@ -67,13 +67,13 @@ pub(crate) async fn check_project(env: Environment, id: i32) -> Result<(), Confi
67
pub struct Config {
68
pub name: String,
69
pub description: String,
70
- pub repository: Repository,
70
+ pub project: Project,
71
}
72
73
#[derive(Deserialize)]
74
-pub struct Repository {
74
+pub struct Project {
75
pub id: i32,
76
- pub name: String,
76
+ pub repository: String,
77
}
78
79
impl Config {
@@ -90,7 +90,7 @@ impl Config {
90
let home = dirs::home_dir().expect("Could not determine home directory");
91
let key_path = home
92
.join(".ssh")
93
- .join(format!("id_{}@smbcloud.xyz", self.repository.name));
93
+ .join(format!("id_{}@smbcloud.xyz", self.project.repository));
94
let key_path_str = key_path.to_string_lossy().to_string();
95
println!("Use key path: {}", key_path_str);
96
key_path_str
crates/cli/src/deploy/mod.rs
+4
-4
@@ -27,7 +27,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
27
let config = check_config().await?;
28
29
// Validate config with project.
30
- check_project(env, config.repository.id).await?;
30
+ check_project(env, config.project.id).await?;
31
32
// Check remote repository setup.
33
let repo = match Repository::open(".") {
@@ -48,7 +48,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
48
}
49
};
50
51
- let mut origin = remote_deployment_setup(&repo, &config.repository.name).await?;
51
+ let mut origin = remote_deployment_setup(&repo, &config.project.repository).await?;
52
53
let commit_hash = match main_branch.resolve() {
54
Ok(result) => match result.target() {
@@ -62,7 +62,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
62
status: DeploymentStatus::Started,
63
};
64
65
- let _deployment = create(env, config.repository.id, payload).await?;
65
+ let _deployment = create(env, config.project.id, payload).await?;
66
67
let mut push_opts = PushOptions::new();
68
let mut callbacks = RemoteCallbacks::new();
@@ -75,7 +75,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
75
if line.contains(&build_next_app()) {
76
println!("Building the app {}", succeed_symbol());
77
}
78
- if line.contains(&start_server(&config.repository.name)) {
78
+ if line.contains(&start_server(&config.project.repository)) {
79
println!("App restart {}", succeed_symbol());
80
}
81
}
crates/cli/src/project/deployment.rs
+3
-3
@@ -21,17 +21,17 @@ pub(crate) async fn process_deployment(
21
// Load project id from .smb/config.toml
22
let config = check_config().await?;
23
24
- check_project(env, config.repository.id).await?;
24
+ check_project(env, config.project.id).await?;
25
26
if let Some(deployment_id) = id {
27
// Show detail for a specific deployment
28
let deployment_id: i32 = deployment_id.parse()?;
29
- let deployment = get_deployment_detail(env, config.repository.id, deployment_id).await?;
29
+ let deployment = get_deployment_detail(env, config.project.id, deployment_id).await?;
30
spinner.stop_and_persist(&succeed_symbol(), succeed_message("Loaded"));
31
show_deployment_detail(&deployment);
32
} else {
33
// List all deployments for the project
34
- let deployments = list_deployments(env, config.repository.id).await?;
34
+ let deployments = list_deployments(env, config.project.id).await?;
35
spinner.stop_and_persist(&succeed_symbol(), succeed_message("Load all deployments"));
36
show_project_deployments(&deployments);
37
};