mirror of
https://github.com/atuinsh/atuin.git
synced 2025-07-07 13:15:09 +00:00
chore: Allow setting script DB path (#2750)
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
Nix / build-test (push) Has been cancelled
build-docker / publish_x86 (push) Has been cancelled
build-docker / publish_aarch64 (push) Has been cancelled
Install / install (macos-14) (push) Has been cancelled
Install / install (ubuntu-latest) (push) Has been cancelled
Nix / check (push) Has been cancelled
Rust / build (macos-14) (push) Has been cancelled
Rust / build (ubuntu-latest) (push) Has been cancelled
Rust / cross-compile (x86_64-unknown-illumos) (push) Has been cancelled
Rust / unit-test (macos-14) (push) Has been cancelled
Rust / unit-test (ubuntu-latest) (push) Has been cancelled
Rust / check (macos-14) (push) Has been cancelled
Rust / check (ubuntu-latest) (push) Has been cancelled
Rust / integration-test (push) Has been cancelled
Rust / clippy (push) Has been cancelled
Rust / format (push) Has been cancelled
Shellcheck / shellcheck (push) Has been cancelled
build-docker / publish_manifest (push) Has been cancelled
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
Nix / build-test (push) Has been cancelled
build-docker / publish_x86 (push) Has been cancelled
build-docker / publish_aarch64 (push) Has been cancelled
Install / install (macos-14) (push) Has been cancelled
Install / install (ubuntu-latest) (push) Has been cancelled
Nix / check (push) Has been cancelled
Rust / build (macos-14) (push) Has been cancelled
Rust / build (ubuntu-latest) (push) Has been cancelled
Rust / cross-compile (x86_64-unknown-illumos) (push) Has been cancelled
Rust / unit-test (macos-14) (push) Has been cancelled
Rust / unit-test (ubuntu-latest) (push) Has been cancelled
Rust / check (macos-14) (push) Has been cancelled
Rust / check (ubuntu-latest) (push) Has been cancelled
Rust / integration-test (push) Has been cancelled
Rust / clippy (push) Has been cancelled
Rust / format (push) Has been cancelled
Shellcheck / shellcheck (push) Has been cancelled
build-docker / publish_manifest (push) Has been cancelled
* chore: Allow setting script DB path * Rename scripts.database_path setting to scripts.db_path to match other crates
This commit is contained in:
parent
a272ea753a
commit
c93991b5d0
6 changed files with 10 additions and 9 deletions
|
@ -13,9 +13,10 @@ Before working on anything, we suggest taking a copy of your Atuin data director
|
|||
While data directory backups are always a good idea, you can instruct Atuin to use custom path using the following environment variables:
|
||||
|
||||
```shell
|
||||
export ATUIN_RECORD_STORE_PATH=/tmp/atuin_records.db
|
||||
export ATUIN_DB_PATH=/tmp/atuin_dev.db
|
||||
export ATUIN_KV__DB_PATH=/tmp/atuin_kv.db
|
||||
export ATUIN_RECORD_STORE_PATH=/tmp/atuin_records.db
|
||||
export ATUIN_SCRIPTS__DB_PATH=/tmp/atuin_scripts.db
|
||||
```
|
||||
|
||||
It is also recommended to update your `$PATH` so that the pre-exec scripts would use the locally built version:
|
||||
|
@ -24,7 +25,7 @@ It is also recommended to update your `$PATH` so that the pre-exec scripts would
|
|||
export PATH="./target/release:$PATH"
|
||||
```
|
||||
|
||||
These 4 variables can be added in a local `.envrc` file, read by [direnv](https://direnv.net/).
|
||||
These 5 variables can be added in a local `.envrc` file, read by [direnv](https://direnv.net/).
|
||||
|
||||
## PRs
|
||||
|
||||
|
|
|
@ -741,6 +741,7 @@ impl Settings {
|
|||
let db_path = data_dir.join("history.db");
|
||||
let record_store_path = data_dir.join("records.db");
|
||||
let kv_path = data_dir.join("kv.db");
|
||||
let scripts_path = data_dir.join("scripts.db");
|
||||
let socket_path = atuin_common::utils::runtime_dir().join("atuin.sock");
|
||||
|
||||
let key_path = data_dir.join("key");
|
||||
|
@ -805,6 +806,7 @@ impl Settings {
|
|||
.set_default("daemon.systemd_socket", false)?
|
||||
.set_default("daemon.tcp_port", 8889)?
|
||||
.set_default("kv.db_path", kv_path.to_str())?
|
||||
.set_default("scripts.db_path", scripts_path.to_str())?
|
||||
.set_default(
|
||||
"search.filters",
|
||||
vec!["global", "host", "session", "workspace", "directory"],
|
||||
|
|
|
@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Settings {
|
||||
pub database_path: String,
|
||||
pub db_path: String,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
|
@ -11,7 +11,7 @@ impl Default for Settings {
|
|||
let path = dir.join("scripts.db");
|
||||
|
||||
Self {
|
||||
database_path: path.to_string_lossy().to_string(),
|
||||
db_path: path.to_string_lossy().to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,8 +561,7 @@ impl Cmd {
|
|||
|
||||
let script_store = ScriptStore::new(store, host_id, encryption_key);
|
||||
let script_db =
|
||||
atuin_scripts::database::Database::new(settings.scripts.database_path.clone(), 1.0)
|
||||
.await?;
|
||||
atuin_scripts::database::Database::new(settings.scripts.db_path.clone(), 1.0).await?;
|
||||
|
||||
match self {
|
||||
Self::New(new_script) => {
|
||||
|
|
|
@ -79,8 +79,7 @@ impl Rebuild {
|
|||
let host_id = Settings::host_id().expect("failed to get host_id");
|
||||
let script_store = ScriptStore::new(store, host_id, encryption_key);
|
||||
let database =
|
||||
atuin_scripts::database::Database::new(settings.scripts.database_path.clone(), 1.0)
|
||||
.await?;
|
||||
atuin_scripts::database::Database::new(settings.scripts.db_path.clone(), 1.0).await?;
|
||||
|
||||
script_store.build(database).await?;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ pub async fn build(
|
|||
kv_store.build().await?;
|
||||
|
||||
let script_db =
|
||||
atuin_scripts::database::Database::new(settings.scripts.database_path.clone(), 1.0).await?;
|
||||
atuin_scripts::database::Database::new(settings.scripts.db_path.clone(), 1.0).await?;
|
||||
script_store.build(script_db).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue