Skip to content

Commit 911106b

Browse files
committed
Add dotenv
1 parent 0d4fb93 commit 911106b

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ basic HTML/CSS/JS changes, directly open in your browser the built
9696
`ui/frontend/build/index.html`.
9797

9898
### Build and run the server
99+
100+
Configure your `.env` file as described in the [ui README](./ui/README.md).
101+
99102
```
100103
cd ui
101-
RUST_LOG=ui=debug \
102-
PLAYGROUND_UI_ROOT=$PWD/frontend/build/ \
103-
PLAYGROUND_GITHUB_TOKEN=YOUR_TOKEN \
104104
cargo run
105105
```
106106

ui/Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ hyper = "0.11.21"
3030
hyper-tls = "0.1.2"
3131
router = "0.6.0"
3232
openssl-probe = "0.1.2"
33+
dotenv = "0.11.0"
3334

3435
[dependencies.playground-middleware]
3536
git = "https://github.com/integer32llc/playground-middleware"

ui/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Configuration
22

3+
When developing, you can place these in a [`.env`][dotenv] file on
4+
disk in this directory.
5+
36
In production, these should be set according to your deployment method
47
of choice.
58

@@ -12,4 +15,5 @@ of choice.
1215
| `PLAYGROUND_LOG_FILE` | No | access-log.csv | The file to record accesses |
1316
| `TMPDIR` | No | system-provided | Where compilation artifacts will be saved. Must be accessible to Docker |
1417

18+
[dotenv]: https://crates.io/crates/dotenv
1519
[gist]: https://developer.github.com/v3/gists/#authentication

ui/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#[macro_use]
44
extern crate log;
55
extern crate env_logger;
6+
extern crate dotenv;
67
extern crate iron;
78
extern crate mount;
89
extern crate router;
@@ -66,6 +67,7 @@ const ONE_YEAR_IN_SECONDS: u64 = 60 * 60 * 24 * 365;
6667
const SANDBOX_CACHE_TIME_TO_LIVE_IN_SECONDS: u64 = ONE_HOUR_IN_SECONDS as u64;
6768

6869
fn main() {
70+
dotenv::dotenv().unwrap();
6971
openssl_probe::init_ssl_cert_env_vars();
7072
env_logger::init();
7173

0 commit comments

Comments
 (0)