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 #55 from golemcloud/url_in_env_var
Browse files Browse the repository at this point in the history
url in env var
  • Loading branch information
senia-psm authored Jan 31, 2024
2 parents d9dee85 + d08ea4a commit e1e319e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ struct GolemCommand {
#[arg(short = 'F', long, default_value = "yaml")]
format: Format,

#[arg(short = 'u', long, default_value = "http://localhost:9001")]
golem_url: String,
#[arg(short = 'u', long)]
/// Golem base url. Default: GOLEM_BASE_URL environment variable or http://localhost:9881.
golem_url: Option<String>,

#[command(subcommand)]
command: Command,
Expand Down Expand Up @@ -112,7 +113,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}

async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>> {
let url_str = cmd.golem_url;
let url_str = cmd
.golem_url
.or_else(|| std::env::var("GOLEM_BASE_URL").ok())
.unwrap_or("http://localhost:9881".to_string());
let url = Url::parse(&url_str).unwrap();
let allow_insecure_str = std::env::var("GOLEM_ALLOW_INSECURE").unwrap_or("false".to_string());
let allow_insecure = allow_insecure_str != "false";
Expand Down

0 comments on commit e1e319e

Please sign in to comment.