Diff
Cargo.toml | 2 +-
docker-compose.yml | 5 +++++
scripts/docker/entrypoint.sh | 22 +++++++++++++++++-----
src/main.rs | 4 ++++
4 files changed, 27 insertions(+), 6 deletions(-)
@@ -17,7 +17,7 @@ bat = { version = "0.24.0", default-features = false, features = ["build-assets"
bytes = "1.5"
bincode = "1.3"
comrak = "0.21.0"
clap = { version = "4.4.10", features = ["cargo", "derive"] }
clap = { version = "4.4.10", features = ["cargo", "derive", "env"] }
futures = "0.3"
git2 = "0.18.0"
hex = "0.4"
@@ -4,6 +4,11 @@ services:
image: ghcr.io/w4/rgit:main
volumes:
- /path/to/my-repos:/git
environment:
- RGIT_DB_STORE=/tmp/rgit-cache.db
- RGIT_BIND_ADDRESS=0.0.0.0:8000
- RGIT_SCAN_PATH=/git
- RGIT_REFRESH_INTERVAL=5m
ports:
- 3333:8000
restart: unless-stopped
@@ -1,8 +1,20 @@
if [ -z ${REFRESH_INTERVAL+x} ];
then
./rgit [::]:8000 /git -d /tmp/rgit-cache.db;
else
./rgit [::]:8000 /git -d /tmp/rgit-cache.db --refresh-interval $REFRESH_INTERVAL;
if [ -z "${RGIT_DB_STORE+x}" ]; then
export RGIT_DB_STORE="/tmp/rgit-cache.db"
fi
if [ -z "${RGIT_BIND_ADDRESS+x}" ]; then
export RGIT_BIND_ADDRESS="[::]:8000"
fi
if [ -z "${RGIT_SCAN_PATH+x}" ]; then
export RGIT_SCAN_PATH="/git"
fi
if [ -z "${RGIT_SCAN_PATH+x}" ]; then
export RGIT_SCAN_PATH="5m"
fi
./rgit
\ No newline at end of file
@@ -68,13 +68,17 @@ pub struct Args {
#[clap(short, long, value_parser)]
#[clap(env = "RGIT_DB_STORE")]
db_store: PathBuf,
#[clap(env = "RGIT_BIND_ADDRESS")]
bind_address: SocketAddr,
#[clap(env = "RGIT_SCAN_PATH")]
scan_path: PathBuf,
#[clap(long, default_value_t = RefreshInterval::Duration(Duration::from_secs(300)))]
#[clap(env = "RGIT_REFRESH_INTERVAL")]
refresh_interval: RefreshInterval,
}