mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 06:00:06 +02:00
fix(portal-api): better handle dev enviroments
This commit is contained in:
parent
2f4e9d4a57
commit
4df7549799
@ -9,6 +9,13 @@ const Resolvers = require('./resolvers');
|
||||
const ContainerPilotWatcher = require('./watch/container-pilot');
|
||||
const MachinesWatcher = require('./watch/machines');
|
||||
|
||||
const {
|
||||
NAMESPACE
|
||||
} = process.env;
|
||||
|
||||
const namespace = NAMESPACE
|
||||
? `/${NAMESPACE}`
|
||||
: '';
|
||||
|
||||
const internals = {};
|
||||
|
||||
@ -59,6 +66,8 @@ module.exports = function (server, options, next) {
|
||||
{
|
||||
register: Graphi,
|
||||
options: {
|
||||
graphqlPath: `${namespace}/graphql`,
|
||||
graphiqlPath: `${namespace}/graphiql`,
|
||||
schema: Schema,
|
||||
resolvers: Resolvers(data)
|
||||
}
|
||||
|
@ -11,7 +11,8 @@
|
||||
"lint-ci": "belly-button",
|
||||
"test": "lab -c",
|
||||
"test-ci": "echo 0",
|
||||
"start": "node server.js"
|
||||
"start": "node server.js",
|
||||
"dev": "CORS=1 NAMESPACE=api node server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "wyatt",
|
||||
|
@ -14,7 +14,13 @@ const Fs = require('fs');
|
||||
const Url = require('url');
|
||||
|
||||
const server = new Hapi.Server();
|
||||
server.connection({ port: 3000 });
|
||||
|
||||
server.connection({
|
||||
port: 3000,
|
||||
routes: {
|
||||
cors: Boolean(process.env.CORS)
|
||||
}
|
||||
});
|
||||
|
||||
const swaggerOptions = {
|
||||
info: {
|
||||
|
Loading…
Reference in New Issue
Block a user