@docupace/pipeline 1.0.7-alpha.8 → 1.0.7-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auth0/cli.js +3 -3
- package/src/auth0/configure.js +13 -6
- package/src/auth0/vault.js +0 -18
package/package.json
CHANGED
package/src/auth0/cli.js
CHANGED
|
@@ -15,10 +15,10 @@ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
|
15
15
|
const program = new Command();
|
|
16
16
|
|
|
17
17
|
program
|
|
18
|
-
.command('configureFromSite <fromSite> <toSite> <env> <deployUI> <deployGraphQLServer> <
|
|
18
|
+
.command('configureFromSite <fromSite> <toSite> <env> <deployUI> <deployGraphQLServer> <useNewDomain>')
|
|
19
19
|
.description('Configure the Auth0 tenants in env for the given site')
|
|
20
|
-
.action(async (fromSite, toSite, env, deployUI, deployGraphQLServer,
|
|
21
|
-
await configureFromSite(fromSite, toSite, env, deployUI, deployGraphQLServer,
|
|
20
|
+
.action(async (fromSite, toSite, env, deployUI, deployGraphQLServer, useNewDomain) => {
|
|
21
|
+
await configureFromSite(fromSite, toSite, env, deployUI, deployGraphQLServer, useNewDomain);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
program
|
package/src/auth0/configure.js
CHANGED
|
@@ -42,7 +42,6 @@ async function initializeAuth0Configuration({
|
|
|
42
42
|
try {
|
|
43
43
|
// Create a new resource server in Auth0
|
|
44
44
|
console.log("Creating resource server in Auth0...");
|
|
45
|
-
console.log(`Secret => ${coreApiIdentifier}`);
|
|
46
45
|
|
|
47
46
|
const resourceServerResponse = await axios.post(
|
|
48
47
|
`https://${auth0Domain}/api/v2/resource-servers`,
|
|
@@ -124,7 +123,7 @@ async function replaceInFile(filePath, replacements) {
|
|
|
124
123
|
await fs.promises.writeFile(filePath, content);
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI, deployGraphQLServer,
|
|
126
|
+
async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI, deployGraphQLServer, commonSecrets) {
|
|
128
127
|
try {
|
|
129
128
|
let uiAllowedCallbacksUrls,
|
|
130
129
|
uiAllowedLogoutUrls;
|
|
@@ -382,15 +381,22 @@ async function configureGraphQLServer(siteHost, coreURL, docupaceHost, site, env
|
|
|
382
381
|
});
|
|
383
382
|
|
|
384
383
|
const graphQLServerClient = auth0Response.data.find(client => client.name === "docupace-graphql");
|
|
384
|
+
const graphQLServerClientCredentials = auth0Response.data.find(client => client.name === "docupace-graphql-client-credentials");
|
|
385
|
+
|
|
385
386
|
const graphQLServerAuth0ClientId = graphQLServerClient.client_id;
|
|
386
387
|
const graphQLServerAuth0ClientSecret = graphQLServerClient.client_secret;
|
|
387
388
|
|
|
389
|
+
const graphQLServerCCAuth0ClientId = graphQLServerClientCredentials.client_id;
|
|
390
|
+
const graphQLServerCCAuth0ClientSecret = graphQLServerClientCredentials.client_secret;
|
|
391
|
+
|
|
388
392
|
// Prepare data payload
|
|
389
393
|
console.log("Preparing Vault GraphQL Server data payload...");
|
|
390
394
|
const graphQLServerSecretData = JSON.stringify({
|
|
391
395
|
data: {
|
|
392
396
|
AUTH0_CLIENT_ID: graphQLServerAuth0ClientId,
|
|
393
397
|
AUTH0_CLIENT_SECRET: graphQLServerAuth0ClientSecret,
|
|
398
|
+
AUTH0_CC_CLIENT_ID: graphQLServerCCAuth0ClientId,
|
|
399
|
+
AUTH0_CC_CLIENT_SECRET: graphQLServerCCAuth0ClientSecret,
|
|
394
400
|
CORE_PASSWORD: commonSecrets.CORE_PASSWORD,
|
|
395
401
|
REMOTE_CONFIG_PATH: commonSecrets.REMOTE_CONFIG_PATH,
|
|
396
402
|
STANDARD_CONFIG_REMOTE_PATH: commonSecrets.STANDARD_CONFIG_REMOTE_PATH,
|
|
@@ -421,6 +427,8 @@ graphqlServer:
|
|
|
421
427
|
CORE_PASSWORD: vault:secret/data/common/config#CORE_PASSWORD
|
|
422
428
|
REMOTE_CONFIG_PATH: vault:secret/data/common/config#REMOTE_CONFIG_PATH
|
|
423
429
|
STANDARD_CONFIG_REMOTE_PATH: vault:secret/data/common/config#STANDARD_CONFIG_REMOTE_PATH
|
|
430
|
+
AUTH0_CC_CLIENT_ID: vault:secret/data/${site}/graphql-server/config#AUTH0_CC_CLIENT_ID
|
|
431
|
+
AUTH0_CC_CLIENT_SECRET: vault:secret/data/${site}/graphql-server/config#AUTH0_CC_CLIENT_SECRET
|
|
424
432
|
image:
|
|
425
433
|
repository: registry.paperout.com/docupace-graphql-server-dev-docker-local/docupace-graphql-server
|
|
426
434
|
tag: ${imageTag}
|
|
@@ -559,17 +567,16 @@ export async function configureFromSite(fromSite, toSite, env, deployUI, deployG
|
|
|
559
567
|
CONNECT_URL = `${oldUrl}_ui`;
|
|
560
568
|
}
|
|
561
569
|
|
|
562
|
-
await templateAuth0(SITE_HOST, CORE_API_CONTEXT, env, filePaths, deployUI, deployGraphQLServer,
|
|
570
|
+
await templateAuth0(SITE_HOST, CORE_API_CONTEXT, env, filePaths, deployUI, deployGraphQLServer, commonSecrets);
|
|
563
571
|
await importAuth0Templates('./auth0-site-setup/template', auth0Domain, auth0ClientId, auth0ClientSecret);
|
|
564
572
|
|
|
565
573
|
if (deployUI === 'true') {
|
|
566
|
-
await configureUI(SITE_HOST, CORE_URL, DOCUPACE_HOST, toSite, env,
|
|
574
|
+
await configureUI(SITE_HOST, CORE_URL, DOCUPACE_HOST, toSite, env, useNewDomain, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Token, uiSecretsPath, uiImageTag, repoPath);
|
|
567
575
|
}
|
|
568
|
-
|
|
576
|
+
|
|
569
577
|
await configureGraphQLServer(SITE_HOST, CORE_URL, DOCUPACE_HOST, toSite, env, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Token, graphqlSecretsPath, graphqlImageTag, shortCommitId, repoPath, commonSecrets);
|
|
570
578
|
await pushDeployConfig(repoPath, `Config update for ${toSite} from ${fromSite} with UI: ${uiImageTag} and GraphQL: ${graphqlImageTag}`);
|
|
571
579
|
|
|
572
|
-
|
|
573
580
|
await initializeAuth0Configuration({
|
|
574
581
|
initConfiguration: "true",
|
|
575
582
|
auth0Domain: auth0Domain,
|
package/src/auth0/vault.js
CHANGED
|
@@ -105,21 +105,3 @@ export async function updateVaultSecrets(vaultPath, secretData) {
|
|
|
105
105
|
// throw error;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
// Example usage
|
|
110
|
-
// (async () => {
|
|
111
|
-
// try {
|
|
112
|
-
// const secretPath = 'secret/data/common/config';
|
|
113
|
-
// const secretData = {
|
|
114
|
-
// data: {
|
|
115
|
-
// key1: 'value1',
|
|
116
|
-
// key2: 'value2',
|
|
117
|
-
// },
|
|
118
|
-
// };
|
|
119
|
-
//
|
|
120
|
-
// const result = await updateVaultSecret(secretPath, secretData);
|
|
121
|
-
// console.log('Secret updated successfully:', result);
|
|
122
|
-
// } catch (err) {
|
|
123
|
-
// console.error(err.message);
|
|
124
|
-
// }
|
|
125
|
-
// })();
|