aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-09 12:08:42 +0000
committerFuwn <[email protected]>2021-06-09 12:08:42 +0000
commit65d37c89ef7fa726b769ea0bcb6759c1724e7ca8 (patch)
treedf17d42e8d5c143c674fa8b97c12e90815252dca
parentstyle(readme): bullet punciation (diff)
downloadwhirl-65d37c89ef7fa726b769ea0bcb6759c1724e7ca8.tar.xz
whirl-65d37c89ef7fa726b769ea0bcb6759c1724e7ca8.zip
feat(global): move whirl-generated files to their own directories
This change is in preperations to the new Docker Compose configuration changes that are planned for the near future. Currently, the Docker Compose configuration does NOT have persistant storage in the form of Docker Volumes, that will change once the planned updates are pushed. The reason Docker Volumes might have not been possible (or at least difficult) is due to the fact that Whirl-generated files were just thrown about, e.g., `whirl.sqlite3`, `Whirl.toml`, all of these files had no central location so having a shared folder in the form of Docker Volume between the container and the host wasn't very possible.j BREAKING CHANGE: Whirl-generated files are moved to their own directories, if the files are not moved, Whirl will continue to look for these files and panic due to being unable to find them!
-rw-r--r--.env2
-rw-r--r--.gitignore8
-rw-r--r--.whirl/Whirl.example.toml (renamed from Whirl.example.toml)0
-rw-r--r--crates/whirl/src/cli.rs2
-rw-r--r--crates/whirl/src/lib.rs2
-rw-r--r--crates/whirl_config/src/lib.rs2
-rw-r--r--crates/whirl_db/src/lib.rs3
-rw-r--r--docker.nix2
-rw-r--r--shell.nix2
9 files changed, 9 insertions, 14 deletions
diff --git a/.env b/.env
index 4391dc8..962c8e2 100644
--- a/.env
+++ b/.env
@@ -1,5 +1,5 @@
# This file is *mostly* just a backup for environment variables in case Nix is
# either not working or you just don't want to use it. :)
-DATABASE_URl=whirl.sqlite3
+DATABASE_URl=.whirl/whirl.sqlite3
RUST_BACKTRACE=1
diff --git a/.gitignore b/.gitignore
index ee93e9b..3904a26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,16 +15,10 @@ Cargo.lock
# Development
/src/_*.*
-/whirl.sqlite3
-/Whirl.toml
+/.whirl/
/.secrets
-/log/
/crates/**/target/
-# DB Browser
-/whirl.sqlite3-shm
-/whirl.sqlite3-wal
-
# Wireshark
*.pcapng
diff --git a/Whirl.example.toml b/.whirl/Whirl.example.toml
index aa2d684..aa2d684 100644
--- a/Whirl.example.toml
+++ b/.whirl/Whirl.example.toml
diff --git a/crates/whirl/src/cli.rs b/crates/whirl/src/cli.rs
index d694cf2..e0d267f 100644
--- a/crates/whirl/src/cli.rs
+++ b/crates/whirl/src/cli.rs
@@ -59,7 +59,7 @@ impl Cli {
_ => unreachable!(),
},
("clean", _) => {
- let cleanable_directories = vec!["log/"];
+ let cleanable_directories = vec![".whirl/log/"];
for dir in cleanable_directories {
let file_type = if dir.ends_with('/') {
"directory"
diff --git a/crates/whirl/src/lib.rs b/crates/whirl/src/lib.rs
index be75fe4..e335d6c 100644
--- a/crates/whirl/src/lib.rs
+++ b/crates/whirl/src/lib.rs
@@ -46,7 +46,7 @@ impl Whirl {
/// - An error may arise if logger fails to start.
pub async fn splash() -> Result<(), Box<dyn std::error::Error>> {
// Environment
- std::env::set_var("DATABASE_URL", "whirl.sqlite3");
+ std::env::set_var("DATABASE_URL", ".whirl/whirl.sqlite3");
// Logging
dotenv::dotenv().ok();
diff --git a/crates/whirl_config/src/lib.rs b/crates/whirl_config/src/lib.rs
index e7bc121..47b26a8 100644
--- a/crates/whirl_config/src/lib.rs
+++ b/crates/whirl_config/src/lib.rs
@@ -59,7 +59,7 @@ impl Config {
fn load() -> Result<Self, ConfigError> {
let mut s = config::Config::new();
- s.merge(File::with_name("./Whirl.toml").required(false))?;
+ s.merge(File::with_name(".whirl/Whirl.toml").required(false))?;
s.try_into()
}
diff --git a/crates/whirl_db/src/lib.rs b/crates/whirl_db/src/lib.rs
index 399e186..41b2863 100644
--- a/crates/whirl_db/src/lib.rs
+++ b/crates/whirl_db/src/lib.rs
@@ -37,7 +37,8 @@ use diesel::prelude::*;
/// - May panic if the database URL is inaccessible.
#[must_use]
pub fn establish_connection() -> SqliteConnection {
- let database_url = std::env::var("DATABASE_URL").unwrap_or_else(|_| "whirl.sqlite3".to_string());
+ let database_url =
+ std::env::var("DATABASE_URL").unwrap_or_else(|_| ".whirl/whirl.sqlite3".to_string());
SqliteConnection::establish(&database_url)
.unwrap_or_else(|_| panic!("error connecting to {}", database_url))
}
diff --git a/docker.nix b/docker.nix
index 3bfd642..79e3308 100644
--- a/docker.nix
+++ b/docker.nix
@@ -33,7 +33,7 @@ let
Cmd = [ "run" ];
WorkingDir = "/";
Env = [
- "DATABASE_URl=whirl.sqlite3"
+ "DATABASE_URl=.whirl/whirl.sqlite3"
"DISABLE_PROMPT=true"
"LOG_FILE=false"
];
diff --git a/shell.nix b/shell.nix
index 3ec4ef2..a9c0c19 100644
--- a/shell.nix
+++ b/shell.nix
@@ -27,7 +27,7 @@ in pkgs.mkShell {
niv
];
- DATABASE_URL = "whirl.sqlite3";
+ DATABASE_URL = ".whirl/whirl.sqlite3";
RUST_SRC_PATH = "${pkgs.latest.rustChannels.nightly.rust-src}/lib/rustlib/src/rust/library";
RUST_BACKTRACE = "1";
}