Skip to content

Commit

Permalink
fix: Removed speachmarks from config (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyE123 authored Jun 19, 2023
1 parent ad126a9 commit 5f7a874
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ You will need to replace `<xxx@xxx.xxx>` and `<password>` with your Packt accoun

To automatically solve the CAPTCHA, you will need an [AntiCaptcha](https://anti-captcha.com/) API key, which you can set by attaching the `-e PACKT_ANTICAPTCHA_KEY=<key>` flag to your docker run command.

You can mount two volumes to persist the Packt credentials and store the downloaded books in a directory on your host system. The `/config` directory will store your Packt credentials, and the `/data` directory will store the downloaded books. You can change the paths of the host directories by modifying the values after the `-v` flag.
`PACKT_SMTP_HOST`, `PACKT_SMTP_PORT`, `PACKT_SMTP_PASSWORD`, `PACKT_SMTP_EMAIL`, `PACKT_SMTP_TO_EMAILS`, `PACKT_SMTP_KINDLE_EMAILS`: These parameters are related to the email notifications feature. If you want to receive email notifications about the downloaded eBooks, you need to provide the SMTP server details and the email addresses for sending the notifications.

Once you run the container, it will automatically download a free eBook each day from Packt publishing and store the files in the `/home/user/packt/books` directory on your host system.
You can mount two volumes to persist the Packt credentials and store the downloaded books in a directory on your host system. The `/config` directory will store your Packt credentials, and the `/data` directory will store the downloaded books. You can change the paths of the host directories by modifying the values after the `-v` flag.

If you would prefer to use an alternative to ghcr.io, you can use the image hosted on [Docker Hub](https://hub.docker.com/repository/docker/ghostwriters/docker-packt-cli) `ghostwriters/docker-packt-cli:latest`,

Expand Down
20 changes: 10 additions & 10 deletions root/etc/s6-overlay/s6-rc.d/init-packt-cli-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,70 @@ fi
# If environment arguments have been provided, switch the values in the config to these.
if [[ -n "$PACKT_EMAIL" ]]; then
echo "ENV PACKT_EMAIL provided"
sed -i "s/email=.*/email=\"$PACKT_EMAIL\"/" "$CFG"
sed -i "s/email=.*/email=$PACKT_EMAIL/" "$CFG"
else
echo "ENV PACKT_EMAIL not set"
fi

if [[ -n "$PACKT_PASSWORD" ]]; then
echo "ENV PACKT_PASSWORD provided"
sed -i "s/password=.*/password=\"$PACKT_PASSWORD\"/" "$CFG"
sed -i "s/password=.*/password=$PACKT_PASSWORD/" "$CFG"
else
echo "ENV PACKT_PASSWORD not set"
fi

if [[ -n "$PACKT_DOWNLOAD_FORMATS" ]]; then
echo "ENV PACKT_DOWNLOAD_FORMATS provided as \"$PACKT_DOWNLOAD_FORMATS\""
sed -i "s/download_formats:.*/download_formats:\ \"$PACKT_DOWNLOAD_FORMATS\"/" "$CFG"
sed -i "s/download_formats:.*/download_formats:\ $PACKT_DOWNLOAD_FORMATS/" "$CFG"
else
echo "ENV PACKT_DOWNLOAD_FORMATS not set"
fi

if [[ -n "$PACKT_ANTICAPTCHA_KEY" ]]; then
echo "ENV PACKT_ANTICAPTCHA_Key provided"
sed -i "s/key:.*/key:\ \"$PACKT_ANTICAPTCHA_KEY\"/" "$CFG"
sed -i "s/key:.*/key:\ $PACKT_ANTICAPTCHA_KEY/" "$CFG"
else
echo "ENV PACKT_ANTICAPTCHA_KEY not set"
fi

if [[ -n "$PACKT_SMTP_HOST" ]]; then
echo "ENV PACKT_SMTP_HOST provided"
sed -i "s/host:.*/host:\ \"$PACKT_SMTP_HOST\"/" "$CFG"
sed -i "s/host:.*/host:\ $PACKT_SMTP_HOST/" "$CFG"
else
echo "ENV PACKT_SMTP_HOST not set"
fi

if [[ -n "$PACKT_SMTP_PORT" ]]; then
echo "ENV PACKT_SMTP_PORT provided"
sed -i "s/port:.*/port:\ \"$PACKT_SMTP_PORT\"/" "$CFG"
sed -i "s/port:.*/port:\ $PACKT_SMTP_PORT/" "$CFG"
else
echo "ENV PACKT_SMTP_PORT not set"
fi

if [[ -n "$PACKT_SMTP_PASSWORD" ]]; then
echo "ENV PACKT_SMTP_PASSWORD provided"
sed -i "s/password:.*/password:\ \"$PACKT_SMTP_PASSWORD\"/" "$CFG"
sed -i "s/password:.*/password:\ $PACKT_SMTP_PASSWORD/" "$CFG"
else
echo "ENV PACKT_SMTP_PASSWORD not set"
fi

if [[ -n "$PACKT_SMTP_EMAIL" ]]; then
echo "ENV PACKT_SMTP_EMAIL provided"
sed -i "s/email:.*/email:\ \"$PACKT_SMTP_EMAIL\"/" "$CFG"
sed -i "s/email:.*/email:\ $PACKT_SMTP_EMAIL/" "$CFG"
else
echo "ENV PACKT_SMTP_EMAIL not set"
fi

if [[ -n "$PACKT_SMTP_TO_EMAILS" ]]; then
echo "ENV PACKT_SMTP_TO_EMAILS provided"
sed -i "s/to_emails:.*/to_emails:\ \"$PACKT_SMTP_TO_EMAILS\"/" "$CFG"
sed -i "s/to_emails:.*/to_emails:\ $PACKT_SMTP_TO_EMAILS/" "$CFG"
else
echo "ENV PACKT_SMTP_TO_EMAILS not set"
fi

if [[ -n "$PACKT_SMTP_KINDLE_EMAILS" ]]; then
echo "ENV PACKT_SMTP_KINDLE_EMAILS provided"
sed -i "s/kindle_emails:.*/kindle_emails:\ \"$PACKT_SMTP_KINDLE_EMAILS\"/" "$CFG"
sed -i "s/kindle_emails:.*/kindle_emails:\ $PACKT_SMTP_KINDLE_EMAILS/" "$CFG"
else
echo "ENV PACKT_SMTP_KINDLE_EMAILS not set"
fi
Expand Down

0 comments on commit 5f7a874

Please sign in to comment.