48 lines
1.5 KiB
Plaintext
48 lines
1.5 KiB
Plaintext
/btwhow is the process to install this program as a command on linux
|
|
to type "$ docmost-rust" on the console and the program starts,
|
|
also how to add env variables for $baseurl $email to
|
|
automatically load this values on the login screen
|
|
|
|
|
|
cargo build --release
|
|
sudo cp target/release/docmost-rust /usr/local/bin/docmost-rust
|
|
|
|
That's it. Any user on the system can now run docmost-rust from any
|
|
directory.
|
|
|
|
If you prefer a user-local install (no sudo):
|
|
cargo install --path .
|
|
This puts the binary in ~/.cargo/bin/, which is already in your
|
|
$PATH if you installed Rust via rustup.
|
|
|
|
---
|
|
Environment variables for pre-filling login
|
|
|
|
Add these to your ~/.bashrc, ~/.zshrc, or
|
|
~/.config/fish/config.fish:
|
|
|
|
bash/zsh:
|
|
export DOCMOST_URL="https://docmost.nakano47.com"
|
|
export DOCMOST_EMAIL="chamagua1@proton.me"
|
|
|
|
fish:
|
|
set -x DOCMOST_URL "https://docmost.nakano47.com"
|
|
set -x DOCMOST_EMAIL "chamagua1@proton.me"
|
|
|
|
Then in the Rust code, replace the hardcoded defaults in
|
|
LoginForm::new() inside src/app.rs:
|
|
|
|
impl LoginForm {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
url: std::env::var("DOCMOST_URL")
|
|
.unwrap_or_else(|_|
|
|
"http://localhost:3000".to_string()),
|
|
email: std::env::var("DOCMOST_EMAIL")
|
|
.unwrap_or_default(),
|
|
password: String::new(),
|
|
// ...
|
|
}
|
|
}
|
|
}
|