The main goal of the project is to monitor the state of the COVID-19 coronavirus and notify via email at the current time about the state of the virus via email.
All settings are stored in the config.env
. File structure (example for Gmail):
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
EMAIL=example@gmail.com
PASSWORD=example_password
REPORT_PERIOD=60
REPORT_TO=example1@gmail.com,example2@gmail.com
FOR_COUNTRY=USA
TELEGRAM_TOKEN=
TELEGRAM_CHAT_ID=
TELEGRAM_PROXY_URL=
Settings SMTP_PORT and REPORT_PERIOD are numbers, and REPORT_PERIOD is the number of minutes to resend the report.
Setting REPORT_TO may contain multiple emails, separated by commas.
Optional setting FOR_COUNTRY - country for which detailed information is required.
If there is no settings file, an exception is thrown.
To start, you can use the command line:
go run .
or
go build . && ./covid-19-reporter
Or build the application using the Makefile
by calling the command:
make
this will create the files covid-19-reporter
for Linux, and covid-19-reporter.exe
for Windows.
In order to run the application as a service, you must:
- Build the application with the
make
command. - In the
covid-19-reporter.service
file, specify the correct path where thecovid-19-reporter
file obtained after the assembly is located. - Copy the file
covid-19-reporter.service
to the directory/etc/systemd/system/
. - Run the service with commands:
systemctl enable covid-19-reporter
systemctl start covid-19-reporter
At the same time, to view service messages, you must call the command:
systemctl -fu covid-19-reporter
https://support.microsoft.com/en-us/help/251192/how-to-create-a-windows-service-by-using-sc-exe
In order to send a report to Telegram you need to create a bot. When you create, you get the settings. Specify the received settings in the file config.env
.
TELEGRAM_TOKEN - token for connecting to Telegrams API.
TELEGRAM_CHAT_ID - ID of the chat to which the report will be sent.
TELEGRAM_PROXY_URL - proxy settings (optional).