-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
29 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "7" | ||
services: | ||
- mongodb | ||
before_script: | ||
- sleep 15 | ||
- mongo chdb_test --eval 'db.addUser("travis", "test");' | ||
env: | ||
global: | ||
- MONGO_URI=mongodb://travis:test@127.0.0.1:27017/chdb_test | ||
- MONGO_URI_TEST=mongodb://travis:test@127.0.0.1:27017/chdb_test | ||
- YOUTUBE_KEY=dummy-key | ||
install: | ||
- npm install | ||
script: | ||
- npm run lint | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,3 @@ | ||
import fs from 'fs'; | ||
import dotenv from 'dotenv'; | ||
|
||
// @todo its a shameless plug. Find another way to store YOUTUBE_API when | ||
// running locally | ||
let dotEnvVars = null; | ||
|
||
function getVars() { | ||
if (!fs.existsSync('.env')) { | ||
return {}; | ||
} | ||
|
||
return fs.readFileSync('.env') | ||
.toString() | ||
.split("\n") | ||
.reduce((p, str) => { | ||
const [key, val] = str.split('='); | ||
if (key) { | ||
p[key] = val; | ||
} | ||
|
||
return p; | ||
}, {}); | ||
} | ||
|
||
function resolveVar(varName) { | ||
if (process.env[varName]) { | ||
return process.env[varName]; | ||
} | ||
|
||
if (!dotEnvVars) { | ||
dotEnvVars = getVars(); | ||
} | ||
|
||
return dotEnvVars[varName] || null; | ||
} | ||
|
||
export const MONGO_URL = resolveVar('MONGO_URL'); | ||
export const MONGO_URL_TEST = resolveVar('MONGO_URL_TEST'); | ||
export const YOUTUBE_KEY = resolveVar('YOUTUBE_KEY'); | ||
export const ANALYTICS_ID = resolveVar('ANALYTICS_ID'); | ||
export default dotenv.config().parsed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters