Skip to content
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

fix(config): Use latest yaml parser to fix bug with comments #64

Merged
merged 1 commit into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"uri-js": "^4.2.2",
"uuid": "^3.3.2",
"winston": "^3.1.0",
"yaml": "1.3.2"
"yaml": "1.4.0"
},
"devDependencies": {
"@adobe/jsonschema2md": "^1.1.1-SNAPSHOT.236",
Expand Down
5 changes: 5 additions & 0 deletions test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ data.strains['no-default'] should NOT have additional properties, data.strains['
config: 'perf.yaml',
result: 'perf.json',
},
{
title: 'loads config with comments',
config: 'various_comments.yaml',
result: 'comments.json',
},
];

describe('Helix Config Loading', () => {
Expand Down
197 changes: 197 additions & 0 deletions test/specs/configs/comments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
{
"strains": {
"adhoc": {
"code": {
"host": "github.com",
"hostname": "github.com",
"owner": "adobe",
"path": "",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"condition": "",
"content": {
"host": "github.com",
"hostname": "github.com",
"owner": "adobe",
"path": "",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"directoryIndex": "index.html",
"package": "75f29aa936bfc2b84bde5ac0ee4afbf824b1391e-dirty",
"perf": {
"connection": "",
"device": "",
"location": ""
},
"static": {
"allow": [],
"deny": [],
"host": "github.com",
"hostname": "github.com",
"magic": false,
"owner": "adobe",
"path": "/htdocs",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"sticky": false,
"urls": []
},
"default": {
"code": {
"host": "github.com",
"hostname": "github.com",
"owner": "adobe",
"path": "",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"condition": "",
"content": {
"host": "github.com",
"hostname": "github.com",
"owner": "adobe",
"path": "",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"directoryIndex": "index.html",
"package": "",
"perf": {
"connection": "",
"device": "",
"location": ""
},
"static": {
"allow": [],
"deny": [],
"host": "github.com",
"hostname": "github.com",
"magic": false,
"owner": "adobe",
"path": "/htdocs",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"sticky": false,
"urls": []
},
"pipeline": {
"code": {
"host": "github.com",
"hostname": "github.com",
"owner": "adobe",
"path": "",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"condition": "req.http.host == \"pipeline.project-helix.io\"",
"content": {
"host": "github.com",
"hostname": "github.com",
"owner": "adobe",
"path": "",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"directoryIndex": "index.html",
"package": "",
"params": [
"search",
"lang"
],
"perf": {
"connection": "",
"device": "",
"location": ""
},
"static": {
"allow": [],
"deny": [],
"host": "github.com",
"hostname": "github.com",
"magic": false,
"owner": "adobe",
"path": "/www",
"port": "",
"protocol": "https",
"ref": "master",
"repo": "project-helix.io"
},
"sticky": true,
"urls": []
},
"proxy": {
"condition": "req.http.host == \"proxy.project-helix.io\"",
"origin": {
"address": "www.adobe.io",
"between_bytes_timeout": 10000,
"connect_timeout": 1000,
"error_threshold": 0,
"first_byte_timeout": 15000,
"hostname": "www.adobe.io",
"max_conn": 200,
"name": "Proxywwwadobeio861b",
"port": 443,
"shield": "iad-va-us",
"ssl_cert_hostname": "www.adobe.io",
"use_ssl": true,
"weight": 100
},
"params": [
"search"
],
"perf": {
"connection": "",
"device": "",
"location": ""
},
"sticky": true,
"urls": []
},
"proxy-detailed": {
"condition": "",
"origin": {
"address": "192.168.0.1",
"between_bytes_timeout": 10000,
"connect_timeout": 1000,
"error_threshold": 0,
"first_byte_timeout": 0,
"hostname": "192.168.0.1",
"max_conn": 200,
"name": "Proxy1921680132fd",
"port": 80,
"shield": "iad-va-us",
"ssl_cert_hostname": "192.168.0.1",
"use_ssl": false,
"weight": 100
},
"perf": {
"connection": "",
"device": "",
"location": ""
},
"sticky": false,
"urls": []
}
},
"version": 1
}
70 changes: 70 additions & 0 deletions test/specs/configs/various_comments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 2018 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
version: 1

definitions:
constants:
defaultRepo:
&myrepo
owner: adobe
repo: project-helix.io
ref: master
strains:
base:
&basestrain
code: *myrepo
content: *myrepo
static: *myrepo

strains:
default: *basestrain

adhoc:
<<: *basestrain
package: 75f29aa936bfc2b84bde5ac0ee4afbf824b1391e-dirty

# client:
# code: *myrepo
# static: *myrepo
# condition: req.http.host == "client.project-helix.io"
# sticky: false
# content:
# repo: helix-cli
# ref: master
# owner: adobe
# directoryIndex: readme.html

pipeline:
<<: *basestrain
condition: req.http.host == "pipeline.project-helix.io"
params:
- search
- lang
#content:
# repo: hypermedia-pipeline
# ref: master
# owner: adobe
static:
<<: *myrepo
path: /www

proxy:
origin: https://www.adobe.io/
condition: req.http.host == "proxy.project-helix.io"
params:
- search
#- api*
sticky: true

proxy-detailed:
origin:
address: 192.168.0.1
# name: publish
use_ssl: false