Update yaml dependency (#728)

* Update yaml dependency

* changelog
This commit is contained in:
Will Hunt 2023-04-25 16:52:57 +01:00 committed by GitHub
parent 43176adf7a
commit 01159fa0d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 37 deletions

1
changelog.d/728.misc Normal file
View File

@ -0,0 +1 @@
Update `yaml` dependency to `2.2.2`

View File

@ -2,7 +2,7 @@
bridge: bridge:
# Basic homeserver configuration # Basic homeserver configuration
#
domain: example.com domain: example.com
url: http://localhost:8008 url: http://localhost:8008
mediaUrl: https://example.com mediaUrl: https://example.com
@ -10,35 +10,35 @@ bridge:
bindAddress: 127.0.0.1 bindAddress: 127.0.0.1
github: github:
# (Optional) Configure this to enable GitHub support # (Optional) Configure this to enable GitHub support
#
auth: auth:
# Authentication for the GitHub App. # Authentication for the GitHub App.
#
id: 123 id: 123
privateKeyFile: github-key.pem privateKeyFile: github-key.pem
webhook: webhook:
# Webhook settings for the GitHub app. # Webhook settings for the GitHub app.
#
secret: secrettoken secret: secrettoken
oauth: oauth:
# (Optional) Settings for allowing users to sign in via OAuth. # (Optional) Settings for allowing users to sign in via OAuth.
#
client_id: foo client_id: foo
client_secret: bar client_secret: bar
redirect_uri: https://example.com/bridge_oauth/ redirect_uri: https://example.com/bridge_oauth/
defaultOptions: defaultOptions:
# (Optional) Default options for GitHub connections. # (Optional) Default options for GitHub connections.
#
showIssueRoomLink: false showIssueRoomLink: false
hotlinkIssues: hotlinkIssues:
prefix: "#" prefix: "#"
userIdPrefix: userIdPrefix:
# (Optional) Prefix used when creating ghost users for GitHub accounts. # (Optional) Prefix used when creating ghost users for GitHub accounts.
#
_github_ _github_
gitlab: gitlab:
# (Optional) Configure this to enable GitLab support # (Optional) Configure this to enable GitLab support
#
instances: instances:
gitlab.com: gitlab.com:
url: https://gitlab.com url: https://gitlab.com
@ -47,11 +47,11 @@ gitlab:
publicUrl: https://example.com/hookshot/ publicUrl: https://example.com/hookshot/
userIdPrefix: userIdPrefix:
# (Optional) Prefix used when creating ghost users for GitLab accounts. # (Optional) Prefix used when creating ghost users for GitLab accounts.
#
_gitlab_ _gitlab_
figma: figma:
# (Optional) Configure this to enable Figma support # (Optional) Configure this to enable Figma support
#
publicUrl: https://example.com/hookshot/ publicUrl: https://example.com/hookshot/
instances: instances:
your-instance: your-instance:
@ -60,22 +60,22 @@ figma:
passcode: your-webhook-passcode passcode: your-webhook-passcode
jira: jira:
# (Optional) Configure this to enable Jira support. Only specify `url` if you are using a On Premise install (i.e. not atlassian.com) # (Optional) Configure this to enable Jira support. Only specify `url` if you are using a On Premise install (i.e. not atlassian.com)
#
webhook: webhook:
# Webhook settings for JIRA # Webhook settings for JIRA
#
secret: secrettoken secret: secrettoken
oauth: oauth:
# (Optional) OAuth settings for connecting users to JIRA. See documentation for more information # (Optional) OAuth settings for connecting users to JIRA. See documentation for more information
#
client_id: foo client_id: foo
client_secret: bar client_secret: bar
redirect_uri: https://example.com/bridge_oauth/ redirect_uri: https://example.com/bridge_oauth/
generic: generic:
# (Optional) Support for generic webhook events. # (Optional) Support for generic webhook events.
#'allowJsTransformationFunctions' will allow users to write short transformation snippets in code, and thus is unsafe in untrusted environments #'allowJsTransformationFunctions' will allow users to write short transformation snippets in code, and thus is unsafe in untrusted environments
#
#
enabled: false enabled: false
enableHttpGet: false enableHttpGet: false
urlPrefix: https://example.com/webhook/ urlPrefix: https://example.com/webhook/
@ -84,27 +84,27 @@ generic:
waitForComplete: false waitForComplete: false
feeds: feeds:
# (Optional) Configure this to enable RSS/Atom feed support # (Optional) Configure this to enable RSS/Atom feed support
#
enabled: false enabled: false
pollIntervalSeconds: 600 pollIntervalSeconds: 600
pollTimeoutSeconds: 30 pollTimeoutSeconds: 30
provisioning: provisioning:
# (Optional) Provisioning API for integration managers # (Optional) Provisioning API for integration managers
#
secret: "!secretToken" secret: "!secretToken"
passFile: passFile:
# A passkey used to encrypt tokens stored inside the bridge. # A passkey used to encrypt tokens stored inside the bridge.
# Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate # Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate
#
passkey.pem passkey.pem
bot: bot:
# (Optional) Define profile information for the bot user # (Optional) Define profile information for the bot user
#
displayname: Hookshot Bot displayname: Hookshot Bot
avatar: mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d avatar: mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d
serviceBots: serviceBots:
# (Optional) Define additional bot users for specific services # (Optional) Define additional bot users for specific services
#
- localpart: feeds - localpart: feeds
displayname: Feeds displayname: Feeds
avatar: mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d avatar: mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d
@ -112,25 +112,25 @@ serviceBots:
service: feeds service: feeds
metrics: metrics:
# (Optional) Prometheus metrics support # (Optional) Prometheus metrics support
#
enabled: true enabled: true
queue: queue:
# (Optional) Message queue / cache configuration options for large scale deployments. # (Optional) Message queue / cache configuration options for large scale deployments.
# For encryption to work, must be set to monolithic mode and have a host & port specified. # For encryption to work, must be set to monolithic mode and have a host & port specified.
#
monolithic: true monolithic: true
port: 6379 port: 6379
host: localhost host: localhost
logging: logging:
# (Optional) Logging settings. You can have a severity debug,info,warn,error # (Optional) Logging settings. You can have a severity debug,info,warn,error
#
level: info level: info
colorize: true colorize: true
json: false json: false
timestampFormat: HH:mm:ss:SSS timestampFormat: HH:mm:ss:SSS
widgets: widgets:
# (Optional) EXPERIMENTAL support for complimentary widgets # (Optional) EXPERIMENTAL support for complimentary widgets
#
addToAdminRooms: false addToAdminRooms: false
disallowedIpRanges: disallowedIpRanges:
- 127.0.0.0/8 - 127.0.0.0/8
@ -159,7 +159,7 @@ widgets:
widgetTitle: Hookshot Configuration widgetTitle: Hookshot Configuration
permissions: permissions:
# (Optional) Permissions for using the bridge. See docs/setup.md#permissions for help # (Optional) Permissions for using the bridge. See docs/setup.md#permissions for help
#
- actor: example.com - actor: example.com
services: services:
- service: "*" - service: "*"
@ -170,7 +170,7 @@ listeners:
# 'port' must be specified. Each listener must listen on a unique port. # 'port' must be specified. Each listener must listen on a unique port.
# 'bindAddress' will default to '127.0.0.1' if not specified, which may not be suited to Docker environments. # 'bindAddress' will default to '127.0.0.1' if not specified, which may not be suited to Docker environments.
# 'resources' may be any of webhooks, widgets, metrics, provisioning # 'resources' may be any of webhooks, widgets, metrics, provisioning
#
- port: 9000 - port: 9000
bindAddress: 0.0.0.0 bindAddress: 0.0.0.0
resources: resources:

View File

@ -71,7 +71,7 @@
"vm2": "^3.9.17", "vm2": "^3.9.17",
"winston": "^3.3.3", "winston": "^3.3.3",
"xml2js": "^0.5.0", "xml2js": "^0.5.0",
"yaml": "^1.10.2" "yaml": "^2.2.2"
}, },
"devDependencies": { "devDependencies": {
"@codemirror/lang-javascript": "^6.0.2", "@codemirror/lang-javascript": "^6.0.2",

View File

@ -1,7 +1,6 @@
import { BridgeConfig, BridgeConfigRoot } from "./Config"; import { BridgeConfig, BridgeConfigRoot } from "./Config";
import YAML from "yaml";
import { getConfigKeyMetadata, keyIsHidden } from "./Decorators"; import { getConfigKeyMetadata, keyIsHidden } from "./Decorators";
import { Node, YAMLSeq } from "yaml/types"; import { Node, YAMLSeq, default as YAML } from "yaml";
import { randomBytes } from "crypto"; import { randomBytes } from "crypto";
import { DefaultDisallowedIpRanges } from "matrix-appservice-bridge"; import { DefaultDisallowedIpRanges } from "matrix-appservice-bridge";
@ -164,15 +163,15 @@ function renderSection(doc: YAML.Document, obj: Record<string, unknown>, parentN
let newNode: Node; let newNode: Node;
if (typeof value === "object" && !Array.isArray(value)) { if (typeof value === "object" && !Array.isArray(value)) {
newNode = YAML.createNode({}); newNode = doc.createNode({});
renderSection(doc, value as Record<string, unknown>, newNode as YAMLSeq); renderSection(doc, value as Record<string, unknown>, newNode as YAMLSeq);
} else if (typeof value === "function") { } else if (typeof value === "function") {
if (value.length !== 0) { if (value.length !== 0) {
throw Error("Only zero-argument functions are allowed as config values"); throw Error("Only zero-argument functions are allowed as config values");
} }
newNode = YAML.createNode(value()); newNode = doc.createNode(value());
} else { } else {
newNode = YAML.createNode(value); newNode = doc.createNode(value);
} }
const metadata = getConfigKeyMetadata(obj, key); const metadata = getConfigKeyMetadata(obj, key);
@ -190,7 +189,7 @@ function renderSection(doc: YAML.Document, obj: Record<string, unknown>, parentN
function renderDefaultConfig() { function renderDefaultConfig() {
const doc = new YAML.Document(); const doc = new YAML.Document();
doc.contents = YAML.createNode({}); doc.contents = doc.createNode({});
doc.commentBefore = ' This is an example configuration file'; doc.commentBefore = ' This is an example configuration file';
// Needed because the entries syntax below would not work otherwise // Needed because the entries syntax below would not work otherwise
renderSection(doc, DefaultConfig as unknown as Record<string, unknown>); renderSection(doc, DefaultConfig as unknown as Record<string, unknown>);

View File

@ -6243,10 +6243,10 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
yaml@^1.10.2: yaml@^2.2.2:
version "1.10.2" version "2.2.2"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.2.tgz#ec551ef37326e6d42872dad1970300f8eb83a073"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== integrity sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==
yargs-parser@20.2.4: yargs-parser@20.2.4:
version "20.2.4" version "20.2.4"