mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-03-21 17:34:19 -05:00
feat: add config option to enable automatic cleanup
This commit is contained in:
parent
c19feefcb7
commit
1d0bacfb9d
63
README.md
63
README.md
|
|
@ -11,37 +11,38 @@ Handles all BOSS (Background Online Storage Service) related tasks for the Prete
|
|||
|
||||
Configurations are loaded through environment variables. `.env` files are supported.
|
||||
|
||||
| Environment variable | Description | Default |
|
||||
| -------------------------------------------- | ----------------------------------------------------------------- | --------------------------------------------- |
|
||||
| `PN_BOSS_CONFIG_HTTP_PORT` | The HTTP port the server listens on | None |
|
||||
| `PN_BOSS_CONFIG_LOG_FORMAT` | What logging format to use, possible options: `pretty` or `json` | `pretty` |
|
||||
| `PN_BOSS_CONFIG_LOG_LEVEL` | What log level to use | `info` |
|
||||
| `PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY` | The BOSS WiiU AES key, needs to be dumped from a console | None |
|
||||
| `PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY` | The BOSS WiiU HMAC key, needs to be dumped from a console | None |
|
||||
| `PN_BOSS_CONFIG_BOSS_3DS_AES_KEY` | The BOSS 3DS AES key, needs to be dumped from a console | None |
|
||||
| `PN_BOSS_CONFIG_MONGO_CONNECTION_STRING` | MongoDB connection string | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_BOSS_SERVER_ADDRESS` | Address for the GRPC server to listen on | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_BOSS_SERVER_PORT` | Port for the GRPC server to listen on | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_BOSS_SERVER_API_KEY` | API key that services will use to connect to the BOSS GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_ADDRESS` | Address of the account GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_PORT` | Port of the account GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_API_KEY` | API key of the account GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_FRIENDS_SERVER_ADDRESS` | Address of the friends GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_FRIENDS_SERVER_PORT` | Port of the friends GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_FRIENDS_SERVER_API_KEY` | API key of the friends GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_S3_ENDPOINT` | S3 server endpoint | None |
|
||||
| `PN_BOSS_CONFIG_S3_REGION` | S3 server region | None |
|
||||
| `PN_BOSS_CONFIG_S3_BUCKET` | S3 server bucket | None |
|
||||
| `PN_BOSS_CONFIG_S3_ACCESS_KEY` | S3 access key | None |
|
||||
| `PN_BOSS_CONFIG_S3_ACCESS_SECRET` | S3 access key secret | None |
|
||||
| `PN_BOSS_CONFIG_CDN_DISK_PATH` | Storage path for the CDN, use as alternative for S3 | None |
|
||||
| `PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED` | Should Streetpass Relay be enabled? | `false` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPDI` | What domain should the NPDI component use? | `npdi.cdn.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPDL` | What domain should the NPDL component use? | `npdl.cdn.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPFL` | What domain should the NPFL component use? | `npfl.c.app.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPPL` | What domain should the NPPL component use? | `nppl.app.pretendo.cc,nppl.c.app.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPTS` | What domain should the NPTS component use? | `npts.app.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_SPR` | What domain should the SPR component use? | `service.spr.app.pretendo.cc` |
|
||||
| Environment variable | Description | Default |
|
||||
| ------------------------------------------------ | ----------------------------------------------------------------- | --------------------------------------------- |
|
||||
| `PN_BOSS_CONFIG_HTTP_PORT` | The HTTP port the server listens on | None |
|
||||
| `PN_BOSS_CONFIG_LOG_FORMAT` | What logging format to use, possible options: `pretty` or `json` | `pretty` |
|
||||
| `PN_BOSS_CONFIG_LOG_LEVEL` | What log level to use | `info` |
|
||||
| `PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY` | The BOSS WiiU AES key, needs to be dumped from a console | None |
|
||||
| `PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY` | The BOSS WiiU HMAC key, needs to be dumped from a console | None |
|
||||
| `PN_BOSS_CONFIG_BOSS_3DS_AES_KEY` | The BOSS 3DS AES key, needs to be dumped from a console | None |
|
||||
| `PN_BOSS_CONFIG_MONGO_CONNECTION_STRING` | MongoDB connection string | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_BOSS_SERVER_ADDRESS` | Address for the GRPC server to listen on | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_BOSS_SERVER_PORT` | Port for the GRPC server to listen on | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_BOSS_SERVER_API_KEY` | API key that services will use to connect to the BOSS GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_ADDRESS` | Address of the account GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_PORT` | Port of the account GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_API_KEY` | API key of the account GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_FRIENDS_SERVER_ADDRESS` | Address of the friends GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_FRIENDS_SERVER_PORT` | Port of the friends GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_GRPC_FRIENDS_SERVER_API_KEY` | API key of the friends GRPC server | None |
|
||||
| `PN_BOSS_CONFIG_S3_ENDPOINT` | S3 server endpoint | None |
|
||||
| `PN_BOSS_CONFIG_S3_REGION` | S3 server region | None |
|
||||
| `PN_BOSS_CONFIG_S3_BUCKET` | S3 server bucket | None |
|
||||
| `PN_BOSS_CONFIG_S3_ACCESS_KEY` | S3 access key | None |
|
||||
| `PN_BOSS_CONFIG_S3_ACCESS_SECRET` | S3 access key secret | None |
|
||||
| `PN_BOSS_CONFIG_CDN_DISK_PATH` | Storage path for the CDN, use as alternative for S3 | None |
|
||||
| `PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED` | Should Streetpass Relay be enabled? | `false` |
|
||||
| `PN_BOSS_CONFIG_STREETPASS_RELAY_CLEAN_OLD_DATA` | Should old Streetpass Relay data be automatically cleaned up? | `false` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPDI` | What domain should the NPDI component use? | `npdi.cdn.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPDL` | What domain should the NPDL component use? | `npdl.cdn.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPFL` | What domain should the NPFL component use? | `npfl.c.app.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPPL` | What domain should the NPPL component use? | `nppl.app.pretendo.cc,nppl.c.app.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_NPTS` | What domain should the NPTS component use? | `npts.app.pretendo.cc` |
|
||||
| `PN_BOSS_CONFIG_DOMAINS_SPR` | What domain should the SPR component use? | `service.spr.app.pretendo.cc` |
|
||||
|
||||
## S3 server
|
||||
The S3 server is optional, you can set `PN_BOSS_CONFIG_CDN_DISK_PATH` if you want to use a local folder as CDN source instead.
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ export const config = {
|
|||
disk_path: process.env.PN_BOSS_CONFIG_CDN_DISK_PATH?.trim() || ''
|
||||
},
|
||||
spr: {
|
||||
enabled: process.env.PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED?.trim().toLowerCase() === 'true'
|
||||
enabled: process.env.PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED?.trim().toLowerCase() === 'true',
|
||||
cleanOldData: process.env.PN_BOSS_CONFIG_STREETPASS_RELAY_CLEAN_OLD_DATA?.trim().toLowerCase() === 'true'
|
||||
},
|
||||
domains: {
|
||||
npdi: (process.env.PN_BOSS_CONFIG_DOMAINS_NPDI || 'npdi.cdn.pretendo.cc').split(','),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { CronJob } from 'cron';
|
||||
import { logger } from './logger';
|
||||
import { deleteOldCECData } from './database';
|
||||
import { config } from './config-manager';
|
||||
|
||||
async function runCleanSprData(): Promise<void> {
|
||||
const maxAgeMs = 14 * 24 * 60 * 60 * 1000; // 14 days
|
||||
|
|
@ -40,5 +41,7 @@ function registerSchedule(schedule: string, name: string, fn: () => void | Promi
|
|||
}
|
||||
|
||||
export async function setupScheduler(): Promise<void> {
|
||||
registerSchedule('0 2 * * *', 'clean-spr-data', runCleanSprData);
|
||||
if (config.spr.cleanOldData) {
|
||||
registerSchedule('0 2 * * *', 'clean-spr-data', runCleanSprData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user