Skip to content

Commit

Permalink
cloud_url in profile (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
senia-psm authored Jul 3, 2024
1 parent d060b1a commit a5d6d34
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions golem-cli/src/command/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ pub struct CloudProfileAdd {
#[arg(long, hide = true)]
dev_component_url: Option<Url>,

/// URL of Golem Cloud service
#[arg(long, hide = true)]
dev_cloud_url: Option<Url>,

/// URL of Golem Worker service. If not provided - use component-url.
#[arg(long, hide = true)]
dev_worker_url: Option<Url>,
Expand Down Expand Up @@ -285,13 +289,15 @@ impl UniversalProfileAddSubCommand {
CloudProfileAdd {
name,
dev_component_url,
dev_cloud_url,
dev_worker_url,
dev_allow_insecure,
default_format,
},
} => {
let profile = Profile::GolemCloud(CloudProfile {
custom_url: dev_component_url,
custom_cloud_url: dev_cloud_url,
custom_worker_url: dev_worker_url,
allow_insecure: dev_allow_insecure,
config: ProfileConfig { default_format },
Expand Down Expand Up @@ -404,6 +410,8 @@ pub struct ProfileView {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub url: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub cloud_url: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub worker_url: Option<Url>,
#[serde(skip_serializing_if = "std::ops::Not::not", default)]
pub allow_insecure: bool,
Expand Down Expand Up @@ -433,13 +441,15 @@ impl ProfileView {
name,
typ: ProfileType::Golem,
url: Some(url),
cloud_url: None,
worker_url,
allow_insecure,
authenticated: None,
config,
},
Profile::GolemCloud(CloudProfile {
custom_url,
custom_cloud_url,
custom_worker_url,
allow_insecure,
auth,
Expand All @@ -449,6 +459,7 @@ impl ProfileView {
name,
typ: ProfileType::GolemCloud,
url: custom_url,
cloud_url: custom_cloud_url,
worker_url: custom_worker_url,
allow_insecure,
authenticated: Some(auth.is_some()),
Expand Down
2 changes: 2 additions & 0 deletions golem-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ pub struct CloudProfile {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub custom_url: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub custom_cloud_url: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub custom_worker_url: Option<Url>,
#[serde(skip_serializing_if = "std::ops::Not::not", default)]
pub allow_insecure: bool,
Expand Down
3 changes: 3 additions & 0 deletions golem-cli/tests/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ fn profile_add_get_list_switch_delete(
name: ProfileName("p_with_worker_url".to_string()),
typ: ProfileType::Golem,
url: Some(Url::parse("http://localhost:9876").unwrap()),
cloud_url: None,
worker_url: Some(Url::parse("http://localhost:9875").unwrap()),
allow_insecure: true,
authenticated: None,
Expand All @@ -125,6 +126,7 @@ fn profile_add_get_list_switch_delete(
name: ProfileName("p_no_worker_url".to_string()),
typ: ProfileType::Golem,
url: Some(Url::parse("http://localhost:9874").unwrap()),
cloud_url: None,
worker_url: None,
allow_insecure: false,
authenticated: None,
Expand All @@ -148,6 +150,7 @@ fn profile_add_get_list_switch_delete(
name: ProfileName("p_2".to_string()),
typ: ProfileType::Golem,
url: Some(Url::parse("http://localhost:9873").unwrap()),
cloud_url: None,
worker_url: None,
allow_insecure: false,
authenticated: None,
Expand Down

0 comments on commit a5d6d34

Please sign in to comment.