Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
Refactor defaults (#111) - fixes #108
Browse files Browse the repository at this point in the history
* moved default values from function code into JSON Schema for #108

* adding coercer for default values/secrets #108
- split validator creation into separate module

* update docs

* unit test for param coercion #108

* fix test for #108
- don't check all secrets, only the one non-default

* set defaults before running image handler test #108

* Fix test by coercing defaults beforehand #108

* fix embed test by coercing defaults #108

* Coerce defaults to fix find embed test #108

* Fix test fetch markdown by coercing defaults

* reducing number of empty lines to a @tripodsan -approved amount

* removing unused condition

* adding REPO_API_ROOT
  • Loading branch information
trieloff authored Nov 21, 2018
1 parent 216ac81 commit f5a90ce
Show file tree
Hide file tree
Showing 21 changed files with 406 additions and 148 deletions.
42 changes: 32 additions & 10 deletions docs/secrets.schema.json

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

90 changes: 74 additions & 16 deletions docs/secrets.schema.md

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

44 changes: 22 additions & 22 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"mdast-util-to-string": "^1.0.4",
"mdurl": "^1.0.1",
"micromatch": "^3.1.10",
"object-hash": "^1.3.1",
"rehype-parse": "^6.0.0",
"remark-frontmatter": "^1.3.0",
"remark-parse": "^6.0.0",
Expand Down
3 changes: 0 additions & 3 deletions src/html/embed-whitelist.json

This file was deleted.

4 changes: 1 addition & 3 deletions src/html/fetch-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const client = require('request-promise-native');
const URI = require('uri-js');
const { bail } = require('../helper');

const GH_RAW = 'https://raw.githubusercontent.com/';

function uri(root, owner, repo, ref, path) {
const rootURI = URI.parse(root);
const rootPath = rootURI.path;
Expand Down Expand Up @@ -73,7 +71,7 @@ async function fetch(
return bail(logger, 'Unknown path, cannot fetch content');
}

const { REPO_RAW_ROOT: rootPath = GH_RAW } = secrets;
const { REPO_RAW_ROOT: rootPath } = secrets;

// everything looks good, make the HTTP request
const options = {
Expand Down
Loading

0 comments on commit f5a90ce

Please sign in to comment.