const express = require('express')
const { postgraphile } = require('postgraphile')
const uuidv4 = require('uuid/v4')
require('dotenv').config()

require('./mail')()

const app = express()

app.get('/', (req, res) =>
  res.json({ message: 'Welcome to the Sagefy service!' })
)

app.get('/x', (req, res) =>
  res.json({ message: 'Welcome to the Sagefy service!' })
)

app.use(
  postgraphile(
    {
      user: process.env.DB_USER || 'sg_postgraphile',
      host: process.env.DB_HOST || 'postgres',
      database: process.env.DB_DATABASE || 'sagefy',
      password: process.env.DB_PASSWORD,
      port: process.env.DB_PORT || 5432,
    },
    process.env.DB_SCHEMA || 'sg_public',
    {
      // Dev, debug, test
      graphiql: true,

      // JWT Authentication
      jwtSecret: process.env.JWT_SECRET || uuidv4(),
      defaultRole: process.env.JWT_ROLE || 'sg_anonymous',
      jwtPgTypeIdentifier: process.env.JWT_TOKEN || 'sg_public.jwt_token',
    }
  )
)

app.listen(process.env.SERVER_PORT || 8653)

@@ -81,42 +81,8 @@
 e')%0A
-const uuidv4 = require('uuid/v4')%0A
 requ
@@ -153,185 +153,8 @@
 ()%0A%0A
-app.get('/', (req, res) =%3E%0A  res.json(%7B message: 'Welcome to the Sagefy service!' %7D)%0A)%0A%0Aapp.get('/x', (req, res) =%3E%0A  res.json(%7B message: 'Welcome to the Sagefy service!' %7D)%0A)%0A%0A
 app.
@@ -215,29 +215,8 @@
 USER
- %7C%7C 'sg_postgraphile'
 ,%0A  
@@ -248,22 +248,8 @@
 HOST
- %7C%7C 'postgres'
 ,%0A  
@@ -289,20 +289,8 @@
 BASE
- %7C%7C 'sagefy'
 ,%0A  
@@ -363,16 +363,8 @@
 PORT
- %7C%7C 5432
 ,%0A  
@@ -397,23 +397,8 @@
 HEMA
- %7C%7C 'sg_public'
 ,%0A  
@@ -521,20 +521,8 @@
 CRET
- %7C%7C uuidv4()
 ,%0A  
@@ -562,26 +562,8 @@
 ROLE
- %7C%7C 'sg_anonymous'
 ,%0A  
@@ -612,33 +612,8 @@
 OKEN
- %7C%7C 'sg_public.jwt_token'
 ,%0A  

Remove defaults in server index