Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 82d4004

Browse files
committed
Move bitly key to playbot.toml
1 parent 4d9f710 commit 82d4004

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ To see a list of attributes, use `~help`:
3333

3434
## System Requirements
3535

36-
Rust-Playpen currently needs to be run on an Arch Linux system that meets
37-
[playpen's requirements][playpen].
36+
Rust-Playpen currently needs to be run on a system with access to Docker.
3837

3938
## IRC Bot Setup
4039

playbot.toml.example

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Playbot's (default) configuration file
22

3+
#bitly-key = "..."
4+
35
[[server]]
46
nicks = ["playbot-rs", "playbot-rs-mini"]
57
#password = "1234"

src/bin/playbot.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ fn get_rust_versions() -> Vec<String> {
4242
versions
4343
}
4444

45-
fn read_bitly_token() -> String {
46-
// Read the bitly API token
47-
let mut key = String::new();
48-
File::open("bitly_key").unwrap().read_to_string(&mut key).unwrap();
49-
// Allow trailing newline
50-
let key = String::from(key.lines().next().unwrap());
51-
key
52-
}
53-
5445
struct Playbot {
5546
conn: IrcServer,
5647
rust_versions: Vec<String>,
@@ -215,15 +206,13 @@ fn main() {{
215206
fn main() {
216207
env_logger::init().unwrap();
217208

218-
fs::metadata("whitelist").expect("syscall whitelist file not found");
219-
220-
let bitly_key = read_bitly_token();
221209
let rust_versions = get_rust_versions();
222210

223211
// FIXME All these unwraps are pretty bad UX, but they should only panic on misconfiguration
224212
let mut config = String::new();
225213
File::open("playbot.toml").unwrap().read_to_string(&mut config).unwrap();
226214
let toml = toml::Parser::new(&config).parse().unwrap();
215+
let bitly_key = toml["bitly-key"].as_str().unwrap().to_string();
227216

228217
let mut threads = Vec::new();
229218
for server in toml["server"].as_slice().unwrap() {

0 commit comments

Comments
 (0)