Adding a Config File

1. Ability to configure variables from a JSON file.
2. By default, checkin.sh does not know the value of checkin_file, this commit fixes that.
3. I want to create a web interface, front end, for this project and it is easier for the PHP server to parse the json data.
This commit is contained in:
MugoSquero
2023-10-17 21:19:03 +03:00
parent 6ecea78954
commit ae0d8943fe
4 changed files with 68 additions and 39 deletions
+20 -18
View File
@@ -23,31 +23,32 @@ Before using the script, you need to have the following prerequisites in place:
## Configuration
You need to configure the script with your SMTP server settings and email details. Open the script and modify the following variables in the "Configuration" section:
You need to configure the config.json file with your SMTP server settings and email details. Open the config file and modify the following variables:
- `smtp_host`: SMTP server hostname.
- `smtp_port`: SMTP server port.
- `smtp_user`: Your SMTP server username.
- `smtp_password`: Your SMTP server password.
- `from_email`: Your email address (the sender).
- `to_email`: Recipient's email address.
- `checkin_file`: Path to the check-in timestamp file.
- `counter_file`: Path to the email counter file.
- `DAYS_REMINDER`: Number of days for the reminder period.
- `DAYS_DEADMAN`: Number of days for the Dead Man's Switch activation.
- `SECONDS_IN_A_DAY`: Number of seconds in a day.
- `count_sent_mail`: Number of dead man mails to send after activation.
- `family_members`: List of family members' email addresses.
- `files_to_attach`: List of files to attach to the emails.
- `config.json`: JSON configuration file containing the following settings:
- `smtp_host`: SMTP server hostname.
- `smtp_port`: SMTP server port.
- `smtp_user`: Your SMTP server username.
- `smtp_password`: Your SMTP server password.
- `from_email`: Your email address (the sender).
- `to_email`: Recipient's email address.
- `checkin_file`: Path to the check-in timestamp file.
- `counter_file`: Path to the email counter file.
- `DAYS_REMINDER`: Number of days for the reminder period.
- `DAYS_DEADMAN`: Number of days for the Dead Man's Switch activation.
- `SECONDS_IN_A_DAY`: Number of seconds in a day.
- `count_sent_mail`: Number of dead man mails to send after activation.
- `family_members`: List of family members' email addresses.
- `files_to_attach`: List of files to attach to the emails.
## Customization
You can customize the email content by modifying the following variables in the script:
You can customize the email content by modifying the following variables in the config:
- `reminder_subject`: Subject for the reminder email.
- `reminder_message`: Message for the reminder email.
- `dead_man_subject`: Subject for the Dead Man's Switch activation email.
- `dead_man_message`: Message for the Dead Man's Switch activation email.
- `dead_man_activation_subject`: Subject for the Dead Man's Switch activation email.
- `dead_man_activation_message`: Message for the Dead Man's Switch activation email.
## Usage
@@ -65,6 +66,7 @@ You can customize the email content by modifying the following variables in the
- [Yusuf İpek](https://github.com/yusufipk)
- [Koray Üstündağ](https://github.com/korayustundag)
- [Mugo Squero](https://github.com/MugoSquero)
## License
This script is provided under the GPL-3.0 License. You are free to use, modify, and distribute it as needed. See the [LICENSE](https://github.com/yusufipk/dead-man-message/blob/master/LICENSE) file for details.