1
Fork 0

Change env variables in API

This commit is contained in:
viktorstrate 2019-08-10 17:47:53 +02:00
parent 11586209bf
commit c3cb98fdaa
4 changed files with 21 additions and 18 deletions

View File

@ -3,6 +3,6 @@ NEO4J_USER=neo4j
NEO4J_PASSWORD=letmein
GRAPHQL_LISTEN_PORT=4001
GRAPHQL_LISTEN_HOST=http://localhost/
API_ENDPOINT=http://localhost:4001/
JWT_SECRET=You-sh0uld_Change-Th1s

View File

@ -2,5 +2,5 @@ import path from 'path'
export default {
cachePath: path.resolve(__dirname, 'cache'),
host: new URL(process.env.GRAPHQL_LISTEN_HOST || 'http://localhost:4001/'),
host: new URL(process.env.API_ENDPOINT || 'http://localhost:4001/'),
}

View File

@ -88,9 +88,9 @@ setInterval(scanner.scanAll, 1000 * 60 * 60 * 4)
const graphPath = '/graphql'
const endpointUrl = new URL(
process.env.GRAPHQL_LISTEN_HOST || 'http://localhost/'
process.env.GRAPHQL_LISTEN_HOST || 'http://localhost:4001/'
)
endpointUrl.port = process.env.GRAPHQL_LISTEN_PORT || 4001
// endpointUrl.port = process.env.GRAPHQL_LISTEN_PORT || 4001
/*
* Create a new ApolloServer instance, serving the GraphQL schema
@ -142,7 +142,9 @@ loadImageRoutes({ app, driver, scanner })
const httpServer = http.createServer(app)
server.installSubscriptionHandlers(httpServer)
httpServer.listen({ port: endpointUrl.port, path: graphPath }, () => {
httpServer.listen(
{ port: process.env.GRAPHQL_LISTEN_PORT, path: graphPath },
() => {
console.log(
`🚀 GraphQL endpoint ready at ${new URL(server.graphqlPath, endpointUrl)}`
)
@ -156,4 +158,5 @@ httpServer.listen({ port: endpointUrl.port, path: graphPath }, () => {
endpointUrl
)}`
)
})
}
)

View File

@ -21,7 +21,7 @@ services:
environment:
- NEO4J_URI=bolt://neo4j:7687
# Change This: The publicly exposed url for the api
- GRAPHQL_LISTEN_HOST=http://localhost/
- API_ENDPOINT=http://localhost:4001/
- GRAPHQL_LISTEN_PORT=4001
volumes:
# Change This: Link photo paths from the host machine