Replace idnotConfig variable with environment variable
Some checks failed
Build and Push to Registry / build-and-push (push) Failing after 38s
Some checks failed
Build and Push to Registry / build-and-push (push) Failing after 38s
This commit is contained in:
parent
8ed2ffb16c
commit
7d102772d9
@ -1,19 +1,18 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { idnotConfig } from '../../config/idnot';
|
|
||||||
import { IdNotUser, ECivility, EOfficeStatus, EIdnotRole } from '../../types';
|
import { IdNotUser, ECivility, EOfficeStatus, EIdnotRole } from '../../types';
|
||||||
|
|
||||||
export class IdNotService {
|
export class IdNotService {
|
||||||
static async exchangeCodeForTokens(code: string) {
|
static async exchangeCodeForTokens(code: string) {
|
||||||
const params = {
|
const params = {
|
||||||
client_id: idnotConfig.CLIENT_ID,
|
client_id: process.env.IDNOT_CLIENT_ID,
|
||||||
client_secret: idnotConfig.CLIENT_SECRET,
|
client_secret: process.env.IDNOT_CLIENT_SECRET,
|
||||||
redirect_uri: idnotConfig.REDIRECT_URI,
|
redirect_uri: process.env.IDNOT_REDIRECT_URI,
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
code: code
|
code: code
|
||||||
};
|
};
|
||||||
|
|
||||||
const tokens = await (
|
const tokens = await (
|
||||||
await fetch(idnotConfig.TOKEN_URL, {
|
await fetch(process.env.IDNOT_TOKEN_URL, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
@ -27,11 +26,11 @@ export class IdNotService {
|
|||||||
|
|
||||||
static async getUserRattachements(idNot: string) {
|
static async getUserRattachements(idNot: string) {
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
key: idnotConfig.IDNOT_API_KEY || '',
|
key: process.env.IDNOT_API_KEY || '',
|
||||||
deleted: 'false'
|
deleted: 'false'
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = `${idnotConfig.IDNOT_ANNUARY_BASE_URL}/api/pp/v2/personnes/${idNot}/rattachements?` + searchParams;
|
const url = `${process.env.IDNOT_ANNUARY_BASE_URL}/api/pp/v2/personnes/${idNot}/rattachements?` + searchParams;
|
||||||
|
|
||||||
const json = await (
|
const json = await (
|
||||||
await fetch(url, {
|
await fetch(url, {
|
||||||
@ -44,11 +43,11 @@ export class IdNotService {
|
|||||||
|
|
||||||
static async getOfficeRattachements(idNot: string) {
|
static async getOfficeRattachements(idNot: string) {
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
key: idnotConfig.IDNOT_API_KEY || '',
|
key: process.env.IDNOT_API_KEY || '',
|
||||||
deleted: 'false'
|
deleted: 'false'
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = `${idnotConfig.IDNOT_ANNUARY_BASE_URL}/api/pp/v2/entites/${idNot}/personnes?` + searchParams;
|
const url = `${process.env.IDNOT_ANNUARY_BASE_URL}/api/pp/v2/entites/${idNot}/personnes?` + searchParams;
|
||||||
|
|
||||||
const json = await (
|
const json = await (
|
||||||
await fetch(url, {
|
await fetch(url, {
|
||||||
@ -61,11 +60,11 @@ export class IdNotService {
|
|||||||
|
|
||||||
static async getUserData(profileIdn: string) {
|
static async getUserData(profileIdn: string) {
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
key: idnotConfig.IDNOT_API_KEY || ''
|
key: process.env.IDNOT_API_KEY || ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const userData = await (
|
const userData = await (
|
||||||
await fetch(`${idnotConfig.API_BASE_URL}/api/pp/v2/rattachements/${profileIdn}?` + searchParams, {
|
await fetch(`${process.env.API_BASE_URL}/api/pp/v2/rattachements/${profileIdn}?` + searchParams, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
).json();
|
).json();
|
||||||
@ -75,11 +74,11 @@ export class IdNotService {
|
|||||||
|
|
||||||
static async getOfficeLocationData(locationsUrl: string) {
|
static async getOfficeLocationData(locationsUrl: string) {
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
key: idnotConfig.IDNOT_API_KEY || ''
|
key: process.env.IDNOT_API_KEY || ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const officeLocationData = await (
|
const officeLocationData = await (
|
||||||
await fetch(`${idnotConfig.API_BASE_URL}${locationsUrl}?` + searchParams, {
|
await fetch(`${process.env.API_BASE_URL}${locationsUrl}?` + searchParams, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
).json();
|
).json();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user