Skip to content

Commit fa39d91

Browse files
Paul Heijmanjuarezr
authored andcommitted
added ability to use .env file
1 parent 03ede27 commit fa39d91

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SOLR_COPY_URL=http://192.168.0.1:8983/solr
2+
SOLR_COPY_DIR=/mnt/backup

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ simplelog = "0.12.*"
2929
crossbeam-channel = "0.5.1"
3030
crossbeam-utils = "0.8.*"
3131
ctrlc = { version = "3.4.*", features = ["termination"] }
32+
dotenvy = "0.15.7"
3233

3334
# standard crate data is left out
3435
[dev-dependencies]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ Command line tool for backup and restore of documents stored in cores of [Apache
1717
<!-- markdownlint <!-- markdownlint-disable-next-line no-inline-html --> -->
1818
[<img alt="Send some cookies" src="http://img.shields.io/liberapay/receives/juarezr.svg?label=Send%20some%20cookies&logo=liberapay">](https://liberapay.com/juarezr/donate)
1919

20+
## Config
21+
22+
The following environment variables can be used for common parameters:
23+
- `SOLR_COPY_URL` for the url pointing to the Solr cluster
24+
- `SOLR_COPY_DIR` for the existing folder where the zip backup files containing the extracted documents are stored
25+
26+
These variables can also be stored in a `.env` file alongside the `solrcopy` binary. See `.env.example`
27+
2028
## Usage
2129

2230
1. Use the command `solrcopy backup` for dumping documents from a Solr core into local zip files.

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ mod testsolr;
5656
// region Main Entry Point
5757

5858
use crate::args::Cli;
59+
use dotenvy::dotenv;
5960

6061
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
62+
63+
dotenv().ok();
64+
6165
let parsed = Cli::parse_from_args()?;
6266

6367
wrangle::command_exec(&parsed)

0 commit comments

Comments
 (0)