-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reporting] Convert main Reporting index to TS #49129
Merged
tsullivan
merged 9 commits into
elastic:master
from
tsullivan:reporting/new-platform-shim-part-ii
Nov 14, 2019
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
05ea029
[Reporting] Convert main Reporting index to TS
tsullivan 66fcc48
Merge branch 'master' into reporting/new-platform-shim-part-ii
elasticmachine 887b587
fix typo that broke build
tsullivan 361f6d3
Merge branch 'master' into reporting/new-platform-shim-part-ii
tsullivan 54f39a8
Merge branch 'master' into reporting/new-platform-shim-part-ii
tsullivan 4c26628
Merge branch 'master' into reporting/new-platform-shim-part-ii
tsullivan ec27882
fix type file import
tsullivan 82d5f0f
Merge branch 'master' into reporting/new-platform-shim-part-ii
elasticmachine 405064d
fix the ts imports for build
tsullivan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { BROWSER_TYPE } from './common/constants'; | ||
// @ts-ignore untyped module | ||
import { config as appConfig } from './server/config/config'; | ||
import { getDefaultChromiumSandboxDisabled } from './server/browsers'; | ||
|
||
export async function config(Joi: any) { | ||
return Joi.object({ | ||
enabled: Joi.boolean().default(true), | ||
kibanaServer: Joi.object({ | ||
protocol: Joi.string().valid(['http', 'https']), | ||
hostname: Joi.string(), | ||
port: Joi.number().integer(), | ||
}).default(), | ||
queue: Joi.object({ | ||
indexInterval: Joi.string().default('week'), | ||
pollEnabled: Joi.boolean().default(true), | ||
pollInterval: Joi.number() | ||
.integer() | ||
.default(3000), | ||
pollIntervalErrorMultiplier: Joi.number() | ||
.integer() | ||
.default(10), | ||
timeout: Joi.number() | ||
.integer() | ||
.default(120000), | ||
}).default(), | ||
capture: Joi.object({ | ||
networkPolicy: Joi.object({ | ||
enabled: Joi.boolean().default(true), | ||
rules: Joi.array() | ||
.items( | ||
Joi.object({ | ||
allow: Joi.boolean().required(), | ||
protocol: Joi.string(), | ||
host: Joi.string(), | ||
}) | ||
) | ||
.default([ | ||
{ allow: true, protocol: 'http:' }, | ||
{ allow: true, protocol: 'https:' }, | ||
{ allow: true, protocol: 'ws:' }, | ||
{ allow: true, protocol: 'wss:' }, | ||
{ allow: true, protocol: 'data:' }, | ||
{ allow: false }, // Default action is to deny! | ||
]), | ||
}).default(), | ||
zoom: Joi.number() | ||
.integer() | ||
.default(2), | ||
viewport: Joi.object({ | ||
width: Joi.number() | ||
.integer() | ||
.default(1950), | ||
height: Joi.number() | ||
.integer() | ||
.default(1200), | ||
}).default(), | ||
timeout: Joi.number() | ||
.integer() | ||
.default(20000), // deprecated | ||
loadDelay: Joi.number() | ||
.integer() | ||
.default(3000), | ||
settleTime: Joi.number() | ||
.integer() | ||
.default(1000), // deprecated | ||
concurrency: Joi.number() | ||
.integer() | ||
.default(appConfig.concurrency), // deprecated | ||
browser: Joi.object({ | ||
type: Joi.any() | ||
.valid(BROWSER_TYPE) | ||
.default(BROWSER_TYPE), | ||
autoDownload: Joi.boolean().when('$dist', { | ||
is: true, | ||
then: Joi.default(false), | ||
otherwise: Joi.default(true), | ||
}), | ||
chromium: Joi.object({ | ||
inspect: Joi.boolean() | ||
.when('$dev', { | ||
is: false, | ||
then: Joi.valid(false), | ||
else: Joi.default(false), | ||
}) | ||
.default(), | ||
disableSandbox: Joi.boolean().default(await getDefaultChromiumSandboxDisabled()), | ||
proxy: Joi.object({ | ||
enabled: Joi.boolean().default(false), | ||
server: Joi.string() | ||
.uri({ scheme: ['http', 'https'] }) | ||
.when('enabled', { | ||
is: Joi.valid(false), | ||
then: Joi.valid(null), | ||
else: Joi.required(), | ||
}), | ||
bypass: Joi.array() | ||
.items(Joi.string().regex(/^[^\s]+$/)) | ||
.when('enabled', { | ||
is: Joi.valid(false), | ||
then: Joi.valid(null), | ||
else: Joi.default([]), | ||
}), | ||
}).default(), | ||
maxScreenshotDimension: Joi.number() | ||
.integer() | ||
.default(1950), | ||
}).default(), | ||
}).default(), | ||
maxAttempts: Joi.number() | ||
.integer() | ||
.greater(0) | ||
.when('$dist', { | ||
is: true, | ||
then: Joi.default(3), | ||
otherwise: Joi.default(1), | ||
}) | ||
.default(), | ||
}).default(), | ||
csv: Joi.object({ | ||
checkForFormulas: Joi.boolean().default(true), | ||
enablePanelActionDownload: Joi.boolean().default(true), | ||
maxSizeBytes: Joi.number() | ||
.integer() | ||
.default(1024 * 1024 * 10), // bytes in a kB * kB in a mB * 10 | ||
scroll: Joi.object({ | ||
duration: Joi.string() | ||
.regex(/^[0-9]+(d|h|m|s|ms|micros|nanos)$/, { name: 'DurationString' }) | ||
.default('30s'), | ||
size: Joi.number() | ||
.integer() | ||
.default(500), | ||
}).default(), | ||
}).default(), | ||
encryptionKey: Joi.when(Joi.ref('$dist'), { | ||
is: true, | ||
then: Joi.string(), | ||
otherwise: Joi.string().default('a'.repeat(32)), | ||
}), | ||
roles: Joi.object({ | ||
allow: Joi.array() | ||
.items(Joi.string()) | ||
.default(['reporting_user']), | ||
}).default(), | ||
index: Joi.string().default('.reporting'), | ||
poll: Joi.object({ | ||
jobCompletionNotifier: Joi.object({ | ||
interval: Joi.number() | ||
.integer() | ||
.default(10000), | ||
intervalErrorMultiplier: Joi.number() | ||
.integer() | ||
.default(5), | ||
}).default(), | ||
jobsRefresh: Joi.object({ | ||
interval: Joi.number() | ||
.integer() | ||
.default(5000), | ||
intervalErrorMultiplier: Joi.number() | ||
.integer() | ||
.default(5), | ||
}).default(), | ||
}).default(), | ||
}).default(); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelgriffith and I have been wanting to split up the Reporting index file for awhile. After converting it to Typescript and having all this code go through prettier, it made sense to break out this config section from the Reporting index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1000