use config file with workflow

Signed-off-by: anas <e.anastayyar@gmail.com>
This commit is contained in:
anas 2021-08-22 01:43:44 +03:00
parent 0c50bcf8ee
commit 87d48d77e7
3 changed files with 14 additions and 41 deletions

View File

@ -17,17 +17,4 @@ jobs:
stack: "container" stack: "container"
region: "us" region: "us"
env: env:
HD_AUTO_DELETE_MESSAGE_DURATION: ${{secrets.AUTO_DELETE_MESSAGE_DURATION}} HD_CONFIG_FILE_URL: ${{secrets.CONFIG_FILE_URL}}
HD_BASE_URL_OF_BOT: ${{secrets.BASE_URL_OF_BOT}}
HD_BOT_TOKEN: ${{secrets.BOT_TOKEN}}
HD_DOWNLOAD_DIR: ${{secrets.DOWNLOAD_DIR}}
HD_DOWNLOAD_STATUS_UPDATE_INTERVAL: ${{secrets.DOWNLOAD_STATUS_UPDATE_INTERVAL}}
HD_IS_TEAM_DRIVE: ${{secrets.IS_TEAM_DRIVE}}
HD_GDRIVE_FOLDER_ID: ${{secrets.GDRIVE_FOLDER_ID}}
HD_HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}}
HD_HEROKU_APP_NAME: ${{secrets.HEROKU_APP_NAME}}
HD_OWNER_ID: ${{secrets.OWNER_ID}}
HD_TELEGRAM_API: ${{secrets.TELEGRAM_API}}
HD_TELEGRAM_HASH: ${{secrets.TELEGRAM_HASH}}
HD_UPSTREAM_REPO: ${{secrets.UPSTREAM_REPO}}
HD_UPSTREAM_BRANCH: ${{secrets.UPSTREAM_BRANCH}}

View File

@ -33,6 +33,12 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
CONFIG_FILE_URL = os.environ.get('CONFIG_FILE_URL', None)
if CONFIG_FILE_URL is not None:
out = subprocess.run(["wget", "-q", "-O", "config.env", CONFIG_FILE_URL])
if out.returncode != 0:
logging.error(out)
load_dotenv('config.env') load_dotenv('config.env')
Interval = [] Interval = []

View File

@ -20,35 +20,15 @@
HEROKU_EMAIL HEROKU_EMAIL
HEROKU_API_KEY HEROKU_API_KEY
HEROKU_APP_NAME HEROKU_APP_NAME
BASE_URL_OF_BOT CONFIG_FILE_URL
BOT_TOKEN
TELEGRAM_API
TELEGRAM_HASH
OWNER_ID
GDRIVE_FOLDER_ID
DOWNLOAD_DIR
DOWNLOAD_STATUS_UPDATE_INTERVAL
AUTO_DELETE_MESSAGE_DURATION
UPSTREAM_REPO
UPSTREAM_BRANCH
``` ```
- To get CONFIG_FILE_URL, check the steps here:
### Description of the above Required Variables ![steps 1 to 3](https://telegra.ph/file/1d8fec16516a87ba9d1ac.jpg)
* `HEROKU_EMAIL` Heroku Account email Id in which the above app will be deployed
* `HEROKU_API_KEY` Go to your Heroku account and go to Account Settings. Scroll to the bottom until you see API Key. Copy this key and add it ![step 4](https://telegra.ph/file/1491f99836cd694ea1195.jpg)
* `HEROKU_APP_NAME` Your Heroku app name, Name Must be unique
* `BASE_URL_OF_BOT` Enter your Heroku app link to avoid the app from sleeping and to make it work with Torrent selection, Example: `https://yourappname.herokuapp.com` (**NOTE**: No slash at the end) ![step 5](https://telegra.ph/file/416a550f7ded579b63272.jpg)
* `BOT_TOKEN` The Telegram bot token that you get from https://t.me/BotFather.
* `TELEGRAM_API` This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes
* `TELEGRAM_HASH` This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org
* `OWNER_ID` The Telegram user ID (not username) of the Owner of the bot
* `GDRIVE_FOLDER_ID` This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors
* `DOWNLOAD_DIR` The path to the local folder where the downloads should be downloaded to, Fill `/usr/src/app/downloads`
* `DOWNLOAD_STATUS_UPDATE_INTERVAL` A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it `5` seconds at least)
* `AUTO_DELETE_MESSAGE_DURATION` Interval of time (in seconds), after which the bot deletes it's message (and command message) which is expected to be viewed instantly. (**Note**: Set to `-1` to never automatically delete messages)
* `UPSTREAM_REPO` Link for Bot Upstream Repo, if you want default update, fill `https://github.com/Slam-Team/slam-mirrorbot`
* `UPSTREAM_BRANCH` Branch name for Bot Upstream Repo, fill `master`
### For Optional Variables you can get from [Here](https://github.com/Slam-Team/slam-mirrorbot#setting-up-config-file)
4. After adding all the above Required Variables go to Github Actions tab in your repo 4. After adding all the above Required Variables go to Github Actions tab in your repo