Fix release builds

This commit is contained in:
Raphaël Thériault 2019-10-17 14:15:39 -04:00
parent c86d1090c8
commit dcd5200485
2 changed files with 9 additions and 5 deletions

View File

@ -8,10 +8,13 @@ edition = "2018"
actix-files = "0.1.5"
actix-web = "1.0.8"
base64 = "0.10.1"
blake2 = "0.8.1"
chrono = "0.4.9"
dirs = "2.0.2"
env_logger = "0.7.0"
futures = "0.1.29"
num_cpus = "1.10.1"
toml = "0.5.3"
[dependencies.diesel]
version = "1.4.2"
features = ["r2d2", "sqlite"]
@ -24,8 +27,3 @@ features = ["derive"]
[target.'cfg(debug_assertions)'.dependencies]
dotenv = "0.14.1"
[target.'cfg(not(debug_assertions))'.dependencies]
blake2 = "0.8.1"
dirs = "2.0.2"
toml = "0.5.3"

View File

@ -8,12 +8,16 @@ use diesel::sqlite::SqliteConnection;
use std::env;
use std::path::PathBuf;
#[cfg(not(debug_assertions))]
use dirs;
#[cfg(debug_assertions)]
use dotenv;
#[cfg(not(debug_assertions))]
use std::fs;
#[cfg(debug_assertions)]
use std::str::FromStr;
#[cfg(not(debug_assertions))]
use toml;
/// Returns a path to the directory storing application data
#[cfg(not(debug_assertions))]
@ -32,6 +36,7 @@ fn get_config_path() -> PathBuf {
}
/// Returns an environment variable and panic if it isn't found
#[cfg(debug_assertions)]
macro_rules! get_env {
($k:literal) => {
env::var($k).expect(&format!("Can't find {} environment variable.", $k));
@ -39,6 +44,7 @@ macro_rules! get_env {
}
/// Returns a parsed environment variable and panic if it isn't found or is not parsable
#[cfg(debug_assertions)]
macro_rules! parse_env {
($k:literal) => {
get_env!($k).parse().expect(&format!("Invalid {}.", $k))