Skip to content

Commit

Permalink
replaces rclone config file with environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Jan 30, 2025
1 parent d6cd568 commit 9edcb7f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 43 deletions.
Empty file added .config/rclone/.keep
Empty file.
24 changes: 0 additions & 24 deletions .config/rclone/rclone.conf.example

This file was deleted.

5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ requirements.txt

docs/_build
bin/digifeeds/*.config
.config/rclone/rclone.conf
.config/rclone/*.json

.config/rclone/*
!.config/rclone/.keep

tmp/*
!tmp/.keep
2 changes: 1 addition & 1 deletion aim/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Services:
digifeeds_google_delivery_reports_rclone_remote=os.getenv(
"DIGIFEEDS_GOOGLE_DELIVERY_REPORTS_RCLONE_REMOTE"
)
or "digifeeds_reports",
or "digifeeds_google_delivery_reports",
hathifiles_store_path=os.getenv("HATHIFILES_STORE_PATH")
or "tmp/hathi_file_list_store.json",
hathifiles_webhook_url=os.getenv("HATHIFILES_WEBHOOK_URL")
Expand Down
19 changes: 18 additions & 1 deletion env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,21 @@ RCLONE_CONFIG_CHAOS_PASS=your_smb_password
RCLONE_CONFIG_CHAOS_DOMAIN=your_smb_domain

RCLONE_CONFIG_DIGIFEEDS_GOOGLE_DELIVERY_REPORTS_TYPE=alias
RCLONE_CONFIG_DIGIFEEDS_GOOGLE_DELIVERY_REPORTS_REMOTE=chaos:your_reports_path
RCLONE_CONFIG_DIGIFEEDS_GOOGLE_DELIVERY_REPORTS_REMOTE=chaos:your_reports_path

RCLONE_CONFIG_DIGIFEEDS_S3_TYPE=s3
RCLONE_CONFIG_DIGIFEEDS_S3_PROVIDER=AWS
RCLONE_CONFIG_DIGIFEEDS_S3_ACCESS_KEY_ID=your_s3_access_key_id
RCLONE_CONFIG_DIGIFEEDS_S3_SECRET_ACCESS_KEY=your_s3_secret_access_key

RCLONE_CONFIG_DIGIFEEDS_BUCKET_TYPE=alias
RCLONE_CONFIG_DIGIFEEDS_BUCKET_REMOTE=digifeeds_s3:your_bucket_name

RCLONE_CONFIG_DIGIFEEDS_PICKUP_TYPE=sftp
RCLONE_CONFIG_DIGIFEEDS_PICKUP_HOST=your_sftp_host
RCLONE_CONFIG_DIGIFEEDS_PICKUP_USER=your_sftp_user
RCLONE_CONFIG_DIGIFEEDS_PICKUP_PORT=your_sftp_port
RCLONE_CONFIG_DIGIFEEDS_PICKUP_PASS=your_sftp_password_hash
RCLONE_CONFIG_DIGIFEEDS_PICKUP_SHELL_TYPE=cmd
RCLONE_CONFIG_DIGIFEEDS_MD5SUM_COMMAND=none
RCLONE_CONFIG_DIGIFEEDS_SHA1SUM_COMMAND=none
23 changes: 8 additions & 15 deletions init.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
#!/usr/bin/env bash

if [ -f ".env" ]; then
echo "🌎 .env exists. Leaving alone"
echo "🌎 .env exists. Leaving alone"
else
echo "🌎 .env does not exist. Copying .env-example to .env"
cp env.example .env
YOUR_UID=$(id -u)
YOUR_GID=$(id -g)
echo "πŸ™‚ Setting your UID (${YOUR_UID}) and GID (${YOUR_UID}) in .env"
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_UID/${YOUR_UID}/ .env)" >.env
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_GID/${YOUR_GID}/ .env)" >.env
fi

if [ -f ".config/rclone/rclone.conf" ]; then
echo "πŸ“‹ .config/rclone/rclone.conf exists. Leaving alone"
else
echo "πŸ“‹ .config/rclone/rclone.conf does not exist. Copying .config/rclone/rclone.conf.example to rclone_config"
cp .config/rclone/rclone.conf.example .config/rclone/rclone.conf
echo "🌎 .env does not exist. Copying .env-example to .env"
cp env.example .env
YOUR_UID=$(id -u)
YOUR_GID=$(id -g)
echo "πŸ™‚ Setting your UID (${YOUR_UID}) and GID (${YOUR_UID}) in .env"
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_UID/${YOUR_UID}/ .env)" >.env
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_GID/${YOUR_GID}/ .env)" >.env
fi

echo "🚒 Build docker images"
Expand Down

0 comments on commit 9edcb7f

Please sign in to comment.