Skip to content

Commit

Permalink
Read the aptly API URL from $APTLY_API_URL
Browse files Browse the repository at this point in the history
This makes it easy to set the token and URL in one place.

Signed-off-by: Ryan Gonzalez <[email protected]>
  • Loading branch information
refi64 committed Jun 20, 2023
1 parent 272fb3b commit bf695cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion aptly-rest/examples/aptlyrestcli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ enum Action {

#[derive(clap::Parser, Debug)]
struct Opts {
#[clap(short = 'u', long, default_value = "http://localhost:8080")]
#[clap(
short = 'u',
long,
env = "APTLY_API_URL",
default_value = "http://localhost:8080"
)]
api_url: Url,
/// Authentication token for the API
#[clap(long, env = "APTLY_API_TOKEN")]
Expand Down
7 changes: 6 additions & 1 deletion aptlyctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ struct Opts {
#[clap(subcommand)]
command: Command,
/// Url for the aptly rest API endpoint
#[clap(short = 'u', long, default_value = "http://localhost:8080")]
#[clap(
short = 'u',
long,
env = "APTLY_API_URL",
default_value = "http://localhost:8080"
)]
api_url: url::Url,
/// Authentication token for the API
#[clap(long, env = "APTLY_API_TOKEN")]
Expand Down
7 changes: 6 additions & 1 deletion obs2aptly/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ use tracing_subscriber::prelude::*;
#[derive(Parser, Debug)]
struct Opts {
/// Url for the aptly rest api endpoint
#[clap(short, long, default_value = "http://localhost:8080")]
#[clap(
short = 'u',
long,
env = "APTLY_API_URL",
default_value = "http://localhost:8080"
)]
api_url: url::Url,
/// Authentication token for the API
#[clap(long, env = "APTLY_API_TOKEN")]
Expand Down

0 comments on commit bf695cf

Please sign in to comment.