auth0 / wt-cli

Webtask CLI - all you need is code
https://webtask.io
MIT License
322 stars 72 forks source link

Support .npmignore #128

Closed glrodasz closed 7 years ago

glrodasz commented 7 years ago

I'm using the express template but I'm using express-jwt as well. The problem is that I cannot take the secrets from the context because I'm trying to protect all the app, so I'm loading a config.json file that I'm ignoring from my .gitignore file but I need it in the webtask. I could use the .npmignore to allow use the config.json in the webtask. There is any chance to support this? or another way to do it?

import express from 'express'
import Webtask from 'webtask-tools'
import bodyParser from 'body-parser'
import jwt from 'express-jwt'
import config from './config.json' // This file is ignore by .gitignore but allow by .npmignore
import items from './routes/items'

const app = express()

app.use(bodyParser.json())

app.use(jwt({
  secret: config.AUTH0_CLIENT_SECRET,
  audience: config.AUTH0_CLIENT_ID,
  issuer: `https://${config.AUTH0_DOMAIN}/`
}))

// Routes
items(app)

module.exports = Webtask.fromExpress(app)
glrodasz commented 7 years ago

I just found that the real issue is that the 6.0.0 version does not load .jsonfiles so I changed for a .js instead.