Skip to content

Commit cae08bb

Browse files
authored
Support reading client/server secret from an environment variable (#18)
1 parent b045d80 commit cae08bb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ path = "src/main.rs"
1717

1818
[dependencies]
1919
anyhow = { version = "1.0.56", features = ["backtrace"] }
20-
clap = { version = "3.1.8", features = ["derive"] }
20+
clap = { version = "3.1.8", features = ["derive", "env"] }
2121
dashmap = "5.2.0"
2222
hex = "0.4.3"
2323
hmac = "0.12.1"

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ OPTIONS:
6565
-h, --help Print help information
6666
-l, --local-host <HOST> The local host to expose [default: localhost]
6767
-p, --port <PORT> Optional port on the remote server to select [default: 0]
68-
-s, --secret <SECRET> Optional secret for authentication
68+
-s, --secret <SECRET> Optional secret for authentication [env: BORE_SECRET]
6969
-t, --to <TO> Address of the remote server to expose local ports to
7070
-V, --version Print version information
7171
```
@@ -92,7 +92,7 @@ USAGE:
9292
OPTIONS:
9393
-h, --help Print help information
9494
--min-port <MIN_PORT> Minimum TCP port number to accept [default: 1024]
95-
-s, --secret <SECRET> Optional secret for authentication
95+
-s, --secret <SECRET> Optional secret for authentication [env: BORE_SECRET]
9696
-V, --version Print version information
9797
```
9898
@@ -116,6 +116,8 @@ bore server --secret my_secret_string
116116
bore local <LOCAL_PORT> --to <TO> --secret my_secret_string
117117
```
118118
119+
`BORE_SECRET` environment variable can also be used for setting the secret for client/server.
120+
119121
## Acknowledgements
120122
121123
Created by Eric Zhang ([@ekzhang1](https://twitter.com/ekzhang1)). Licensed under the [MIT license](LICENSE).

src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ enum Command {
3030
port: u16,
3131

3232
/// Optional secret for authentication.
33-
#[clap(short, long)]
33+
#[clap(short, long, env = "BORE_SECRET", hide_env_values = true)]
3434
secret: Option<String>,
3535
},
3636

@@ -41,7 +41,7 @@ enum Command {
4141
min_port: u16,
4242

4343
/// Optional secret for authentication.
44-
#[clap(short, long)]
44+
#[clap(short, long, env = "BORE_SECRET", hide_env_values = true)]
4545
secret: Option<String>,
4646
},
4747
}

0 commit comments

Comments
 (0)