You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Integrate GitHub Gist functionality and environment variables support
BREAKING CHANGES:
- Removed external gist update scripts (update_gist.sh and update_gist_special.sh)
- Added direct GitHub Gist API integration
Features:
- Added built-in GitHub Gist update functionality
- Added support for environment variables via .env file
- Added new configuration options for GitHub Gist integration:
* EXPORT_GISTS - enables/disables Gist updates (default: false)
* GITHUB_TOKEN - GitHub Personal Access Token
* GIST_ID_MAIN - Gist ID for main domain list
* GIST_ID_SPECIAL - Gist ID for special domain list
Improvements:
- Reduced dependencies by removing external scripts
- Added proper error handling for Gist updates
- Added detailed logging for Gist operations
- Added support for both hardcoded and environment variables
- Improved security by supporting .env file for sensitive data
13. [Installation and Setup](#installation-and-setup)
87
93
14. [Running the Script](#running-the-script)
@@ -100,7 +106,7 @@ Lastly, the script can also aid in generating DNS FWD records, making it a compr
100
106
- **Logging**: A logging mechanism is set up to record events and errors in a log file.
101
107
- **Lock Mechanism**: A file lock is used to ensure that only one instance of the script runs at a time, preventing conflicts.
102
108
- **Directory Initialization**: Required directories are checked and created if they don’t exist.
103
-
- **Dependency Check**: The script verifies the presence of required system tools like `curl`, `grep`, `awk`, `sort`, and `parallel`.
109
+
- **Dependency Check**: The script verifies the presence of required system tools like `curl`, `jq`, `grep`, `awk`, `sort`, and `parallel`.
104
110
105
111
### File Checks and Cleanup
106
112
@@ -442,45 +448,37 @@ tiktok.com
442
448
youtube.co.uk
443
449
```
444
450
445
-
### GitHub Gist Update Scripts
451
+
### GitHub Gist Exports
446
452
447
-
This repository contains two identical shell scripts ([update_gist_special.sh](/update_gist_special.sh) and [update_gist.sh](/update_gist.sh)) that update different GitHub Gists with local file content. The scripts share the same functionality but use different variables and target different Gists.
453
+
Configuration is currently done through environment variables, which can be set in a [.env](/.env.example) file:
448
454
449
-
#### Scripts Overview
455
+
```env
456
+
# Enable or disable Gist updates
457
+
EXPORT_GISTS=true
450
458
451
-
Both scripts perform the same operations but are configured for different Gists:
452
-
- `update_gist_special.sh` - configured for one specific Gist
453
-
- `update_gist.sh` - configured for another Gist
459
+
# GitHub Personal Access Token
460
+
GITHUB_TOKEN="your_github_token"
454
461
455
-
The only difference between these scripts is in their configuration variables (GitHub token, Gist ID, file names, and paths).
456
-
457
-
#### Technical Details
458
-
459
-
The scripts require:
460
-
- `curl` for making API requests
461
-
- `jq` for JSON processing
462
-
463
-
Each script performs the following operations:
464
-
1. Validates the presence of required utilities
465
-
2. Reads the content from a specified local file
466
-
3. Updates the target Gist via GitHub API
467
-
4. Verifies the update was successful
468
-
469
-
#### Usage
470
-
471
-
To use either script, you need to configure the following variables:
472
-
```bash
473
-
GITHUB_TOKEN="your-github-token"
474
-
GIST_ID="your-gist-id"
475
-
FILENAME="filename-in-gist"
476
-
LOCAL_FILE_PATH="path/to/local/file"
462
+
# Gist IDs for main and special lists
463
+
GIST_ID_MAIN="your_main_gist_id"
464
+
GIST_ID_SPECIAL="your_special_gist_id"
477
465
```
478
466
479
-
After configuring the variables, you can run either script to update its corresponding Gist with the content from the specified local file.
467
+
#### Key Features
468
+
- Direct GitHub API integration
469
+
- Support for environment variables
470
+
- Configurable Gist updates
471
+
- Improved error handling
472
+
- Detailed logging
480
473
481
-
#### Note
474
+
#### Requirements
475
+
-`curl` for API requests
476
+
-`jq` for JSON processing
482
477
483
-
While the scripts are identical in functionality, they are maintained as separate files to avoid the need for changing variables when updating different Gists. This approach allows for easier automation and maintenance of multiple Gist updates.
478
+
#### Notes
479
+
- The `.env` file provides a secure way to manage sensitive tokens
480
+
- Environment variables can also be set directly in the shell
481
+
- Set `EXPORT_GISTS=false` to disable Gist updates
484
482
485
483
---
486
484
@@ -490,8 +488,7 @@ While the scripts are identical in functionality, they are maintained as separat
490
488
...
491
489
├── dns-static-updater.rsc # MikroTik RouterOS script for DNS Static records import
492
490
├── mikrotik-domain-filter-bash.sh # Main domain filtering script
493
-
├── update_gist.sh # Script for updating main list Gist
494
-
└── update_gist_special.sh # Script for updating special list Gist
0 commit comments