Commit e54b2759 authored by Gaël Berthaud-Müller's avatar Gaël Berthaud-Müller
Browse files

make nameserver configurable

parent deabdc0e
Pipeline #354 passed with stage
in 1 minute and 21 seconds
......@@ -2,7 +2,9 @@ authority:
jwks: ./jwks.json
base_url: 'https://api.rd.nic.fr/id4me/authority'
listen: '127.0.0.1:8078'
database_url: 'postgres://aim-api:aim-api@localhost:5432/aim-api'
database_url: 'postgres://id4me:id4me@localhost:5432/id4me'
# Cookie encryption keys, in descending order of freshness
cookie_keys:
- change-me
# optional, list of DNS resolvers to use in host[:port] formart
#nameservers: []
......@@ -3,7 +3,7 @@
const Sequelize = require('sequelize'); // eslint-disable-line import/no-unresolved
const { database_url } = require('./config')
const { database_url } = require('./config');
const sequelize = new Sequelize(database_url);
const grantable = new Set([
......
const dns = require('dns');
const { Resolver } = require('dns');
const { nameservers } = require('./config');
const resolver = new Resolver();
if (nameservers && nameservers.length > 0) {
resolver.setServers(nameservers);
}
function getOidcConfigFromDns(identifier) {
// TODO: identifier can be email
......@@ -25,7 +32,7 @@ function getOidcConfigFromDns(identifier) {
function lookupOidcTxt(oidcDomain) {
return new Promise( (resolve, reject) => {
dns.resolve(`_oidc.${oidcDomain}`, 'TXT', (err, data) => {
resolver.resolve(`_oidc.${oidcDomain}`, 'TXT', (err, data) => {
if (err) {
return reject(err)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment