Choose correct env var + proxy /activityPub

This commit is contained in:
Robert Schäfer 2019-03-25 15:24:48 +01:00
parent ebb1c283b7
commit b32c85b2de
3 changed files with 14 additions and 2 deletions

View File

@ -12,6 +12,6 @@ const serverConfig = {
const server = createServer() const server = createServer()
server.start(serverConfig, options => { server.start(serverConfig, options => {
/* eslint-disable-next-line no-console */ /* eslint-disable-next-line no-console */
console.log(`Server ready at ${process.env.GRAPHQL_URI} 🚀`) console.log(`Server ready at ${process.env.CLIENT_URI} 🚀`)
ActivityPub.init(server) ActivityPub.init(server)
}) })

View File

@ -49,7 +49,7 @@ export default {
CreateUser: async (resolve, root, args, context, info) => { CreateUser: async (resolve, root, args, context, info) => {
const keys = generateRsaKeyPair() const keys = generateRsaKeyPair()
Object.assign(args, keys) Object.assign(args, keys)
args.actorId = `${process.env.GRAPHQL_URI}/activitypub/users/${args.slug}` args.actorId = `${activityPub.host}/activitypub/users/${args.slug}`
return resolve(root, args, context, info) return resolve(root, args, context, info)
} }
} }

View File

@ -121,6 +121,18 @@ module.exports = {
proxy: true proxy: true
}, },
proxy: { proxy: {
'/activityPub': {
// make this configurable (nuxt-dotenv)
target: process.env.GRAPHQL_URI || 'http://localhost:4000',
pathRewrite: { '^/activityPub': '' },
toProxy: true, // cloudflare needs that
changeOrigin: true,
headers: {
Accept: 'application/json',
'X-UI-Request': true,
'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL'
}
},
'/api': { '/api': {
// make this configurable (nuxt-dotenv) // make this configurable (nuxt-dotenv)
target: process.env.GRAPHQL_URI || 'http://localhost:4000', target: process.env.GRAPHQL_URI || 'http://localhost:4000',