mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-08-19 23:54:08 -05:00
feat(spr): Add server-side kill switch.
This commit is contained in:
@@ -31,7 +31,8 @@ if (process.env.PN_BOSS_CONFIG_MONGOOSE_CONNECT_OPTIONS_PATH?.trim()) {
|
||||
}
|
||||
|
||||
export const disabledFeatures: DisabledFeatures = {
|
||||
s3: false
|
||||
s3: false,
|
||||
spr: false
|
||||
};
|
||||
|
||||
export const config: Config = {
|
||||
@@ -78,6 +79,9 @@ export const config: Config = {
|
||||
secret: process.env.PN_BOSS_CONFIG_S3_ACCESS_SECRET?.trim() || ''
|
||||
},
|
||||
disk_path: process.env.PN_BOSS_CONFIG_CDN_DISK_PATH?.trim() || ''
|
||||
},
|
||||
spr: {
|
||||
enabled: process.env.PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED?.trim().toLowerCase() === 'true'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -174,6 +178,15 @@ if (!config.cdn.s3.secret) {
|
||||
disabledFeatures.s3 = true;
|
||||
}
|
||||
|
||||
if (!config.spr.enabled) {
|
||||
warnings.push('PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED is not set or disabled. Disabling feature. To enable feature set the PN_BOSS_CONFIG_STREETPASS_RELAY_ENABLED environment variable');
|
||||
disabledFeatures.spr = true;
|
||||
}
|
||||
|
||||
if (config.spr.enabled) {
|
||||
disabledFeatures.spr = false;
|
||||
}
|
||||
|
||||
if (disabledFeatures.s3) {
|
||||
if (!config.cdn.disk_path) {
|
||||
errors.push('s3 file storage is disabled and no CDN disk path was set. Set the PN_BOSS_CONFIG_CDN_DISK_PATH environment variable');
|
||||
|
||||
@@ -2,6 +2,7 @@ import xmlbuilder from 'xmlbuilder';
|
||||
import moment from 'moment';
|
||||
import express from 'express';
|
||||
import subdomain from 'express-subdomain';
|
||||
import { disabledFeatures } from '@/config-manager';
|
||||
import type { PolicyList } from '@/types/common/policylist';
|
||||
|
||||
const nppl = express.Router();
|
||||
@@ -39,61 +40,110 @@ function get3DSPolicyList(countryCode: string, majorVersion: string): { PolicyLi
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO - Pull this from the DB and use the country code
|
||||
return {
|
||||
PolicyList: {
|
||||
MajorVersion: Number(majorVersion),
|
||||
MinorVersion: 0,
|
||||
ListId: 1891,
|
||||
DefaultStop: false,
|
||||
ForceVersionUp: false,
|
||||
UpdateTime: moment().utc().format('YYYY-MM-DDTHH:MM:SS+0000'),
|
||||
Priority: [
|
||||
{
|
||||
TitleId: '0004003000008f02',
|
||||
TaskId: 'basho0',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000bc00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000bd00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000be00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '0004003000008f02',
|
||||
TaskId: 'pl',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '0004013000003400',
|
||||
TaskId: 'sprelay',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
if (!disabledFeatures.spr) {
|
||||
return {
|
||||
PolicyList: {
|
||||
MajorVersion: Number(majorVersion),
|
||||
MinorVersion: 0,
|
||||
ListId: 1891,
|
||||
DefaultStop: false,
|
||||
ForceVersionUp: false,
|
||||
UpdateTime: moment().utc().format('YYYY-MM-DDTHH:MM:SS+0000'),
|
||||
Priority: [
|
||||
{
|
||||
TitleId: '0004003000008f02',
|
||||
TaskId: 'basho0',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000bc00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000bd00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000be00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '0004003000008f02',
|
||||
TaskId: 'pl',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '0004013000003400',
|
||||
TaskId: 'sprelay',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
PolicyList: {
|
||||
MajorVersion: Number(majorVersion),
|
||||
MinorVersion: 0,
|
||||
ListId: 1891,
|
||||
DefaultStop: false,
|
||||
ForceVersionUp: false,
|
||||
UpdateTime: moment().utc().format('YYYY-MM-DDTHH:MM:SS+0000'),
|
||||
Priority: [
|
||||
{
|
||||
TitleId: '0004003000008f02',
|
||||
TaskId: 'basho0',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000bc00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000bd00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '000400300000be00',
|
||||
TaskId: 'OlvNotf',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
},
|
||||
{
|
||||
TitleId: '0004003000008f02',
|
||||
TaskId: 'pl',
|
||||
Level: 'HIGH',
|
||||
Persistent: true, // TODO - What's this?
|
||||
Revive: true // TODO - What's this?
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getWiiUPolicyList(countryCode: string, majorVersion: string): { PolicyList: PolicyList } | null {
|
||||
|
||||
@@ -2,6 +2,7 @@ import type mongoose from 'mongoose';
|
||||
|
||||
export interface DisabledFeatures {
|
||||
s3: boolean;
|
||||
spr: boolean;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
@@ -49,4 +50,7 @@ export interface Config {
|
||||
};
|
||||
disk_path: string;
|
||||
};
|
||||
spr: {
|
||||
enabled: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user