Skip to content

Commit

Permalink
Support reading client/server secret from an environment variable (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun authored Apr 14, 2022
1 parent b045d80 commit cae08bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ path = "src/main.rs"

[dependencies]
anyhow = { version = "1.0.56", features = ["backtrace"] }
clap = { version = "3.1.8", features = ["derive"] }
clap = { version = "3.1.8", features = ["derive", "env"] }
dashmap = "5.2.0"
hex = "0.4.3"
hmac = "0.12.1"
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ OPTIONS:
-h, --help Print help information
-l, --local-host <HOST> The local host to expose [default: localhost]
-p, --port <PORT> Optional port on the remote server to select [default: 0]
-s, --secret <SECRET> Optional secret for authentication
-s, --secret <SECRET> Optional secret for authentication [env: BORE_SECRET]
-t, --to <TO> Address of the remote server to expose local ports to
-V, --version Print version information
```
Expand All @@ -92,7 +92,7 @@ USAGE:
OPTIONS:
-h, --help Print help information
--min-port <MIN_PORT> Minimum TCP port number to accept [default: 1024]
-s, --secret <SECRET> Optional secret for authentication
-s, --secret <SECRET> Optional secret for authentication [env: BORE_SECRET]
-V, --version Print version information
```
Expand All @@ -116,6 +116,8 @@ bore server --secret my_secret_string
bore local <LOCAL_PORT> --to <TO> --secret my_secret_string
```
`BORE_SECRET` environment variable can also be used for setting the secret for client/server.
## Acknowledgements
Created by Eric Zhang ([@ekzhang1](https://twitter.com/ekzhang1)). Licensed under the [MIT license](LICENSE).
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum Command {
port: u16,

/// Optional secret for authentication.
#[clap(short, long)]
#[clap(short, long, env = "BORE_SECRET", hide_env_values = true)]
secret: Option<String>,
},

Expand All @@ -41,7 +41,7 @@ enum Command {
min_port: u16,

/// Optional secret for authentication.
#[clap(short, long)]
#[clap(short, long, env = "BORE_SECRET", hide_env_values = true)]
secret: Option<String>,
},
}
Expand Down

0 comments on commit cae08bb

Please sign in to comment.