Add .env support to make life easier

This commit is contained in:
ewin 2025-08-20 00:02:08 -06:00
parent 78ad0761b3
commit 79a833133c
Signed by: erin
SSH key fingerprint: SHA256:swjoHhREbZPbWe+gyJNi24d4NAxJSyUIm3fpZj4z3wc
7 changed files with 16 additions and 6 deletions

View file

@ -9,4 +9,10 @@ Scripts for other one-time maintenance tasks (e.g. bulk renames) can be found fo
## Usage
You'll need a recent version of Node.js (22+). Install dependencies via `npm ci`, set the `MW_USERNAME` and `MW_PASSWORD` environment variables to your account username and [bot password](https://www.mediawiki.org/wiki/Manual:Bot_passwords) respectively, then run the scripts in the `bin` folder.
You'll need a recent version of Node.js (22+). Install dependencies: `npm ci`, rename `.env.example` to `.env` and set `MW_USERNAME` and `MW_PASSWORD` to your account username and [bot password](https://www.mediawiki.org/wiki/Manual:Bot_passwords) respectively, then run the scripts in the `bin` folder.
### Environment variables
- `MW_SCRIPTPATH`: The base URL for API requests for your wiki. For the XIV wiki it's `https://ffxiv.consolegameswiki.com/mediawiki`; other wikis may use paths other than `/mediawiki`, which can be identified in Special:Version as "Script path".
- `MW_USERNAME` and `MW_PASSWORD`: Account username and [bot password](https://www.mediawiki.org/wiki/Manual:Bot_passwords), respectively
- `MW_KILLPAGE`: The name of a page that will be checked when running unattended scripts. If this page contains content, the bot will be killed. This allows other editors to kill the bot if it starts misbehaving and you're not watching it.