Skip to content

Commit e3eef4d

Browse files
committed
move env variables into config file
1 parent e5cec3b commit e3eef4d

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

next.config.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,14 @@ module.exports = {
1111
process.env.OSM_API ||
1212
process.env.OSM_DOMAIN ||
1313
'https://www.openstreetmap.org',
14-
OSM_HYDRA_ID: process.env.OSM_HYDRA_ID || 'manage',
15-
OSM_HYDRA_SECRET: process.env.OSM_HYDRA_SECRET || 'manage-secret',
16-
OSM_CONSUMER_KEY: process.env.OSM_CONSUMER_KEY,
17-
OSM_CONSUMER_SECRET: process.env.OSM_CONSUMER_SECRET,
18-
HYDRA_TOKEN_HOST: process.env.HYDRA_TOKEN_HOST || 'http://localhost:4444',
19-
HYDRA_TOKEN_PATH: process.env.HYDRA_TOKEN_PATH || '/oauth2/token',
20-
HYDRA_AUTHZ_HOST: process.env.HYDRA_AUTHZ_HOST || 'http://localhost:4444',
21-
HYDRA_AUTHZ_PATH: process.env.HYDRA_AUTHZ_PATH || '/oauth2/auth',
22-
HYDRA_ADMIN_HOST: process.env.HYDRA_ADMIN_HOST || 'http://localhost:4445',
2314
},
2415
basePath: process.env.BASE_PATH || '',
2516
env: {
2617
APP_URL: process.env.APP_URL || vercelUrl || 'http://127.0.0.1:3000',
2718
OSM_NAME: process.env.OSM_NAME || 'OSM',
2819
BASE_PATH: process.env.BASE_PATH || '',
20+
HYDRA_URL: process.env.HYDRA_URL || 'https://auth.mapping.team/hyauth',
21+
AUTH_URL: process.env.AUTH_URL || 'https://auth.mapping.team',
2922
},
3023
eslint: {
3124
dirs: [

src/middlewares/base-handler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import logger from '../lib/logger'
33
import { getToken } from 'next-auth/jwt'
44
import Boom from '@hapi/boom'
55

6-
const AUTH_URL = process.env.AUTH_URL || 'https://auth.mapping.team'
7-
86
/**
97
* This file contains the base handler to be used in all API routes.
108
*
@@ -71,7 +69,7 @@ export function createBaseHandler() {
7169
'Authorization scheme not supported. Only Bearer scheme is supported'
7270
)
7371
} else {
74-
const result = await fetch(`${AUTH_URL}/api/introspect`, {
72+
const result = await fetch(`${process.env.AUTH_URL}/api/introspect`, {
7573
method: 'POST',
7674
headers: {
7775
Accept: 'application/json',

src/pages/api/auth/[...nextauth].js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ import NextAuth from 'next-auth'
22
import { mergeDeepRight } from 'ramda'
33
const db = require('../../../lib/db')
44

5-
const HYDRA_URL = process.env.HYDRA_URL || 'https://auth.mapping.team/hyauth'
6-
75
export const authOptions = {
86
// Configure one or more authentication providers
97
providers: [
108
{
119
id: 'osm-teams',
1210
name: 'OSM Teams',
1311
type: 'oauth',
14-
wellKnown: `${HYDRA_URL}/.well-known/openid-configuration`,
12+
wellKnown: `${process.env.HYDRA_URL}/.well-known/openid-configuration`,
1513
authorization: { params: { scope: 'openid offline' } },
1614
idToken: true,
1715
async profile(profile) {

0 commit comments

Comments
 (0)