-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
69 lines (54 loc) · 2.37 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require('dotenv').config();
const HOME = require('os').homedir();
const config = {
report_file: process.env.REPORT_FILE || 'report.json',
slide_file: process.env.SLIDE_FILE || 'sprint-report.pptx',
// scraper vars
issue_url: process.env.ISSUE_URL,
sprint_report_url: process.env.SPRINT_REPORT_URL,
// optional vars
sprint_report_table_columns: process.env.SPRINT_REPORT_TABLE_COLUMNS || 6,
chrome_user_profile_path: process.env.CHROME_USER_PROFILE_PATH || `${HOME}/Library/Application Support/Google/Chrome/Default`,
chrome_exe_path: process.env.CHROME_EXE_PATH || '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
// slide defaults
author: process.env.AUTHOR || '',
revision: process.env.REVISION || '1.0',
subject: process.env.SUBJECT,
title: process.env.TITLE,
font_display: process.env.FONT_DISPLAY || 'Arial',
font: process.env.FONT || 'Arial',
color_primary: process.env.COLOR_PRIMARY || '1C5EB0',
color_secondary: process.env.COLOR_SECONDARY || '009999',
color_title_font: process.env.COLOR_TITLE_FONT || 'FFFFFF',
color_title_background: process.env.COLOR_TITLE_BACKGROUND || '1C5EB0',
color_content_font: process.env.COLOR_CONTENT_FONT || '1A1A1A',
color_content_background: process.env.COLOR_CONTENT_BACKGROUND || 'F7F7F7',
color_end_font: process.env.COLOR_END_FONT || 'FFFFFF',
color_end_background: process.env.COLOR_END_BACKGROUND || '1A1A1A',
image_title_background: process.env.IMAGE_TITLE_BACKGROUND || 'assets/background.jpg',
image_section_background: process.env.IMAGE_SECTION_BACKGROUND || 'assets/background.jpg',
image_end_background: process.env.IMAGE_END_BACKGROUND || 'assets/background_end.jpg',
text_overview: process.env.TEXT_OVERVIEW || 'Features',
text_end_thanks: process.env.TEXT_END_THANKS || 'Thank you',
text_end_credits: process.env.TEXT_END_CREDITS || 'Go Team! 👏',
};
function checkConfig(...args) {
// console.log('🔧', args, JSON.stringify(this));
let result = true;
const props = args && args[0] ? args : Object.keys(this);
// console.log('🔧', props);
props.forEach(prop => {
if (!this[prop]) {
console.warn(`⚠️ expected env var '${prop.toUpperCase()}'`);
result = false;
}
});
return result;
};
exports.config = {
...config
}
exports.checkConfig = function (...args) {
checkConfig = checkConfig.bind(config);
return checkConfig(...args);
}