Skip to content

Commit b3904fa

Browse files
committed
Use config.minutes_base_url
1 parent 6f2e97c commit b3904fa

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ gDate = gDate.match(/([0-9]{4}-[0-9]{2}-[0-9]{2})/)[1];
8181
scrawl.group = config.group || 'Telecon';
8282
scrawl.people = JSON.parse(peopleJson);
8383

84+
// we can't make any URLs without this...so fail...
85+
if (!('minutes_base_url' in config)) {
86+
console.error('Error: The `minutes_base_url` was not set in the config');
87+
process.exit(1);
88+
}
89+
// Location of date-based minutes folders; MUST end in a forward slash
90+
scrawl.minutes_base_url = config.minutes_base_url;
91+
8492
// Mustache template - vars: gDate, formattedItems, content, minutes_base_url
8593
const GPLUS_BODY = ('gplus' in config && 'body' in config.gplus)
8694
? config.gplus.body
@@ -105,10 +113,6 @@ const TWITTER_BODY = ('twitter' in config && 'body' in config.twitter)
105113
const WORDPRESS_TITLE = ('wordpress' in config && 'title' in config.wordpress)
106114
? config.wordpress.title
107115
: 'Meeting Minutes for {{gDate}}';
108-
// Location of date-based minutes folders; MUST end in a forward slash
109-
const MINUTES_BASE_URL = 'https://json-ld.github.io/minutes/'
110-
111-
scrawl.minutes_base_url = MINUTES_BASE_URL;
112116

113117
/************************* Utility Functions *********************************/
114118
function postToWordpress(username, password, content, callback) {
@@ -124,12 +128,12 @@ function postToWordpress(username, password, content, callback) {
124128
wpSummary = wpSummary.substring(
125129
wpSummary.indexOf('<dl>'), wpSummary.indexOf('</dl>') + 5);
126130
wpSummary = wpSummary.replace(/href=\"#/g,
127-
'href="' + MINUTES_BASE_URL + gDate + '/#');
131+
'href="' + scrawl.minutes_base_url + gDate + '/#');
128132
wpSummary = wpSummary.replace(/href=\"audio/g,
129-
'href="' + MINUTES_BASE_URL + gDate + '/audio');
133+
'href="' + scrawl.minutes_base_url + gDate + '/audio');
130134
wpSummary = wpSummary.replace(/<div><audio[\s\S]*\/audio><\/div>/g, '');
131135
wpSummary += '<p>Detailed minutes and recorded audio for this call are ' +
132-
'<a href="' + MINUTES_BASE_URL + gDate +
136+
'<a href="' + scrawl.minutes_base_url + gDate +
133137
'/">available in the archive</a>.</p>';
134138

135139
// calculate the proper post date

0 commit comments

Comments
 (0)