diff --git a/README.md b/README.md index 4cb78f5..9a606d5 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,11 @@ Under development, however mainly for personal use! **Note:** If you had previously built and run the script locally, remove the `/node_modules` and `/dist` from your Microsoft-Rewards-Script folder. 1. Download the source code -2. Make changes to your `accounts.json` and `config.json` -3. **Headless mode must be enabled.** You can do this in `config.json` or by using the `HEADLESS=true` environmental variable in docker run or docker compose.yaml (see below). Environmental variables are prioritized over the values in config.json. -4. The container has in-built scheduling. Customize your schedule using the `CRON_START_TIME` environmental variable. Use [crontab.guru](crontab.guru) if you're unsure how to create a cron schedule. -5. **Note:** the container will add between 5 and 50 minutes of randomized variability to your scheduled start times. +2. Make changes to your `accounts.json` and `config.json`. +3. Use volume mapping (see sample compose.yaml) to ensure these files are stored on your local machine and not inside the container. This way, your data (like account settings and config options) will persist even if the container is restarted or updated. +4. **Headless mode must be enabled.** You can do this in `config.json` or by using the `HEADLESS=true` environmental variable in docker run or docker compose.yaml (see below). Environmental variables are prioritized over the values in config.json. +5. The container has in-built scheduling. Customize your schedule using the `CRON_START_TIME` environmental variable. Use [crontab.guru](crontab.guru) if you're unsure how to create a cron schedule. +6. **Note:** the container will add between 5 and 50 minutes of randomized variability to your scheduled start times. ### Option 1: build and run with docker run diff --git a/compose.yaml b/compose.yaml index 5484970..a400b68 100644 --- a/compose.yaml +++ b/compose.yaml @@ -10,4 +10,13 @@ services: - CRON_START_TIME=0 5,11 * * * ### Run on start, set to false to only run the script per the cron schedule - RUN_ON_START=true - restart: unless-stopped \ No newline at end of file + volumes: + ### Replace "/path/to/" with the actual path to where you want to save the files on your local machine. + - /path/to/accounts.json:/usr/src/microsoft-rewards-script/dist/accounts.json + - /path/to/config.json:/usr/src/microsoft-rewards-script/dist/config.json + - /path/to/sessions:/usr/src/microsoft-rewards-script/dist/browser/sessions #optional, saves your login session + deploy: + resources: + limits: + memory: 2048M + restart: unless-stopped diff --git a/src/run_daily.sh b/src/run_daily.sh index 31656fd..037f02e 100644 --- a/src/run_daily.sh +++ b/src/run_daily.sh @@ -28,5 +28,8 @@ sleep $SLEEPTIME # Log the start of the script echo "Starting script..." +# Update config with environment variables before running the script +node src/updateConfig.js + # Execute the Node.js script directly npm run start