Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from golemcloud/allow_insecure
Browse files Browse the repository at this point in the history
Support for insecure golem urls
  • Loading branch information
vigoo authored Sep 6, 2023
2 parents 09c5bee + 770b6b7 commit 61ca4c5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ clap = { version = "4.4.1", features = ["derive"] }
clap-verbosity-flag = "2.0.1"
derive_more = "0.99.17"
futures-util = "0.3.28"
golem-client = "0.0.40"
golem-client = "0.0.42"
golem-examples = "0.1.5"
http = "0.2.9"
indoc = "2.0.3"
Expand Down
15 changes: 13 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,26 +240,31 @@ async fn handle_deploy(
}

async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>> {
let utl_str =
let url_str =
std::env::var("GOLEM_BASE_URL").unwrap_or("https://release.api.golem.cloud/".to_string());
let url = Url::parse(&utl_str).unwrap();
let url = Url::parse(&url_str).unwrap();
let home = std::env::var("HOME").unwrap();
let allow_insecure_str = std::env::var("GOLEM_ALLOW_INSECURE").unwrap_or("false".to_string());
let allow_insecure = allow_insecure_str != "false";
let default_conf_dir = PathBuf::from(format!("{home}/.golem"));

let login = LoginClientLive {
login: golem_client::login::LoginLive {
base_url: url.clone(),
allow_insecure,
},
};
let auth_srv = AuthLive { login };
let account_client = AccountClientLive {
account: golem_client::account::AccountLive {
base_url: url.clone(),
allow_insecure,
},
};
let grant_client = GrantClientLive {
client: GrantLive {
base_url: url.clone(),
allow_insecure,
},
};
let acc_srv = AccountHandlerLive {
Expand All @@ -269,6 +274,7 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let token_client = TokenClientLive {
client: golem_client::token::TokenLive {
base_url: url.clone(),
allow_insecure,
},
};
let token_srv = TokenHandlerLive {
Expand All @@ -277,6 +283,7 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let project_client = ProjectClientLive {
client: ProjectLive {
base_url: url.clone(),
allow_insecure,
},
};
let project_srv = ProjectHandlerLive {
Expand All @@ -285,6 +292,7 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let template_client = TemplateClientLive {
client: ComponentLive {
base_url: url.clone(),
allow_insecure,
},
};
let template_srv = TemplateHandlerLive {
Expand All @@ -294,6 +302,7 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let project_policy_client = ProjectPolicyClientLive {
client: ProjectPolicyLive {
base_url: url.clone(),
allow_insecure,
},
};
let project_policy_srv = ProjectPolicyHandlerLive {
Expand All @@ -302,6 +311,7 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let project_grant_client = ProjectGrantClientLive {
client: ProjectGrantLive {
base_url: url.clone(),
allow_insecure,
},
};
let project_grant_srv = ProjectGrantHandlerLive {
Expand All @@ -311,6 +321,7 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let worker_client = WorkerClientLive {
client: InstanceLive {
base_url: url.clone(),
allow_insecure,
},
base_url: url.clone(),
};
Expand Down

0 comments on commit 61ca4c5

Please sign in to comment.