Skip to content

Commit 42fa160

Browse files
committed
wip: cleanup
1 parent c53124c commit 42fa160

File tree

3 files changed

+21
-45
lines changed

3 files changed

+21
-45
lines changed

meteor/server/api/snapshot.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import { importIngestRundown } from './ingest/http'
3939
import { DBRundownPlaylist } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
4040
import { RundownLayoutBase } from '@sofie-automation/meteor-lib/dist/collections/RundownLayouts'
4141
import { DBTriggeredActions } from '@sofie-automation/meteor-lib/dist/collections/TriggeredActions'
42-
import { Settings } from '../Settings'
4342
import { MethodContext, MethodContextAPI } from './methodContext'
4443
import { saveIntoDb, sumChanges } from '../lib/database'
4544
import * as fs from 'fs'
@@ -154,9 +153,6 @@ async function createSystemSnapshot(
154153
const coreSystem = await getCoreSystemAsync()
155154
if (!coreSystem) throw new Meteor.Error(500, `coreSystem not set up`)
156155

157-
if (Settings.enableUserAccounts && !organizationId)
158-
throw new Meteor.Error(500, 'Not able to create a systemSnaphost without organizationId')
159-
160156
let queryStudio: MongoQuery<DBStudio> = {}
161157
let queryShowStyleBases: MongoQuery<DBShowStyleBase> = {}
162158
let queryShowStyleVariants: MongoQuery<DBShowStyleVariant> = {}

meteor/server/systemStatus/api.ts

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
} from '@sofie-automation/meteor-lib/dist/api/systemStatus'
77
import { getDebugStates, getSystemStatus } from './systemStatus'
88
import { protectString } from '../lib/tempLib'
9-
import { Settings } from '../Settings'
109
import { MethodContextAPI } from '../api/methodContext'
1110
import { profiler } from '../api/profiler'
1211
import { PeripheralDeviceId } from '@sofie-automation/corelib/dist/dataModel/Ids'
@@ -22,53 +21,38 @@ const apmNamespace = 'http'
2221
export const metricsRouter = new KoaRouter()
2322
export const healthRouter = new KoaRouter()
2423

25-
if (!Settings.enableUserAccounts) {
26-
// For backwards compatibility:
24+
metricsRouter.get('/', async (ctx) => {
25+
const transaction = profiler.startTransaction('metrics', apmNamespace)
26+
try {
27+
ctx.response.type = PrometheusHTTPContentType
2728

28-
metricsRouter.get('/', async (ctx) => {
29-
const transaction = profiler.startTransaction('metrics', apmNamespace)
30-
try {
31-
ctx.response.type = PrometheusHTTPContentType
29+
const [meteorMetrics, workerMetrics] = await Promise.all([
30+
getPrometheusMetricsString(),
31+
collectWorkerPrometheusMetrics(),
32+
])
3233

33-
const [meteorMetrics, workerMetrics] = await Promise.all([
34-
getPrometheusMetricsString(),
35-
collectWorkerPrometheusMetrics(),
36-
])
37-
38-
ctx.body = [meteorMetrics, ...workerMetrics].join('\n\n')
39-
} catch (ex) {
40-
ctx.response.status = 500
41-
ctx.body = ex + ''
42-
}
43-
transaction?.end()
44-
})
45-
46-
healthRouter.get('/', async (ctx) => {
47-
const transaction = profiler.startTransaction('health', apmNamespace)
48-
const status = await getSystemStatus(ctx)
49-
health(status, ctx)
50-
transaction?.end()
51-
})
34+
ctx.body = [meteorMetrics, ...workerMetrics].join('\n\n')
35+
} catch (ex) {
36+
ctx.response.status = 500
37+
ctx.body = ex + ''
38+
}
39+
transaction?.end()
40+
})
5241

53-
healthRouter.get('/:studioId', async (ctx) => {
54-
const transaction = profiler.startTransaction('health', apmNamespace)
55-
const status = await getSystemStatus(ctx, protectString(ctx.params.studioId))
56-
health(status, ctx)
57-
transaction?.end()
58-
})
59-
}
60-
healthRouter.get('/:token', async (ctx) => {
42+
healthRouter.get('/', async (ctx) => {
6143
const transaction = profiler.startTransaction('health', apmNamespace)
6244
const status = await getSystemStatus(ctx)
6345
health(status, ctx)
6446
transaction?.end()
6547
})
66-
healthRouter.get('/:token/:studioId', async (ctx) => {
48+
49+
healthRouter.get('/:studioId', async (ctx) => {
6750
const transaction = profiler.startTransaction('health', apmNamespace)
6851
const status = await getSystemStatus(ctx, protectString(ctx.params.studioId))
6952
health(status, ctx)
7053
transaction?.end()
7154
})
55+
7256
function health(status: StatusResponse, ctx: Koa.ParameterizedContext) {
7357
ctx.response.type = 'application/json'
7458

packages/meteor-lib/src/Settings.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export interface ISettings {
1717
defaultTimeScale: number
1818
// Allow grabbing the entire timeline
1919
allowGrabbingTimeline: boolean
20-
/** If true, enables security measures, access control and user accounts. */
21-
/** @deprecated */
22-
enableUserAccounts: boolean
23-
/** If true, enable header based security measures */
20+
/** If true, enable http header based security measures */
2421
enableHeaderAuth: boolean
2522
/** Default duration to use to render parts when no duration is provided */
2623
defaultDisplayDuration: number
@@ -72,8 +69,7 @@ export const DEFAULT_SETTINGS = Object.freeze<ISettings>({
7269
disableBlurBorder: false,
7370
defaultTimeScale: 1,
7471
allowGrabbingTimeline: true,
75-
enableUserAccounts: false,
76-
enableHeaderAuth: true, // nocommit - hack for testing
72+
enableHeaderAuth: false,
7773
defaultDisplayDuration: 3000,
7874
allowMultiplePlaylistsInGUI: false,
7975
poisonKey: 'Escape',

0 commit comments

Comments
 (0)