summary history branches tags files
commit:413b48ac31411185ac763e4450339476bcc0437f
author:Trevor Bentley
committer:Trevor Bentley
date:Fri Apr 7 12:15:37 2017 +0200
parents:47b539c02240468027cbc0f261c7a135507f2e8b
Use connectr.ini.in as config template.
diff --git a/Cargo.toml b/Cargo.toml
line changes: +1/-0
index 4843c2d..3259d78
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@
 name = "connectr"
 version = "0.0.1"
 authors = [ "Trevor Bentley <trevor@trevorbentley.com>" ]
+build = "build.rs"
 
 [dependencies]
 curl = "0.4.6"

diff --git a/build.rs b/build.rs
line changes: +16/-0
index 0000000..15c907a
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,16 @@
+use std::fs;
+use std::path::Path;
+fn main() {
+    // Copy connectr.ini.in to connectr.ini if connectr.ini does not exist.
+    //
+    // The local changes in connectr.ini are always preserved, so you can
+    // set private keys without worrying about git.
+    let ini_file = Path::new("connectr.ini");
+    if !ini_file.exists() {
+        let _ = fs::copy("connectr.ini.in", "connectr.ini");
+    }
+
+    // Try again on re-build if either INI file has changed.
+    println!("cargo:rerun-if-changed=connectr.ini");
+    println!("cargo:rerun-if-changed=connectr.ini.in");
+}

diff --git a/connectr.ini b/connectr.ini
line changes: +0/-6
index cd17682..0000000
--- a/connectr.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[connectr]
-port = 5432
-
-[application]
-client_id = <SPOTIFY_CLIENT_ID>
-secret = <SPOTIFY_CLIENT_SECRET>

diff --git a/connectr.ini.in b/connectr.ini.in
line changes: +6/-0
index 0000000..cd17682
--- /dev/null
+++ b/connectr.ini.in
@@ -0,0 +1,6 @@
+[connectr]
+port = 5432
+
+[application]
+client_id = <SPOTIFY_CLIENT_ID>
+secret = <SPOTIFY_CLIENT_SECRET>