From 8f0af8607b025010233e9fc1cc210389ebe46082 Mon Sep 17 00:00:00 2001 From: Jakub Knetl Date: Thu, 1 Feb 2024 11:11:50 +0100 Subject: [PATCH] Improve passing env variables --- .env.example | 3 +++ .gitignore | 2 ++ README.md | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..db2b9d4 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +SCRAPER_SMTP_USER=your_mail@example.com +SCRAPER_SMTP_PASSWORD=your-secret-password +SCRAPER_TO_MAIL=recipient-email@example.com \ No newline at end of file diff --git a/.gitignore b/.gitignore index f3ef673..cb3f99a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.env + # Created by https://www.toptal.com/developers/gitignore/api/python,intellij+all # Edit at https://www.toptal.com/developers/gitignore?templates=python,intellij+all diff --git a/README.md b/README.md index 4f8677d..79f47a7 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,19 @@ SCRAPER_SMTP_PASSWORD SCRAPER_TO_MAIL ``` +You can define them in shell or make use of .env.example file and copy it to `.env` (the docker example uses that approach) + It uses Google SMTP server (you have to provide google app credentials). Run with: - ``` python main.py +``` + +or build docker image and run it using the docker: + +``` +docker build -t lidl-price-scraper . +docker run -it --rm --env-file ./.env lidl-price-scraper ``` \ No newline at end of file