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

Commit

Permalink
url in env var
Browse files Browse the repository at this point in the history
  • Loading branch information
senia-psm committed Jan 31, 2024
1 parent d9dee85 commit d08ea4a
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 d08ea4a

Please sign in to comment.