Skip to content

Commit

Permalink
tenant creation env file
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabi-02 committed Jan 20, 2024
1 parent e3fa95e commit db5086e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
node_modules
**/.env
!fusionauth/.env
!fusionauth/.env
!tenant/.env
4 changes: 4 additions & 0 deletions tenant/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
APP_URL=http://localhost
FA_URL=http://localhost:9011
FA_API_KEY=33052c8a-c283-4e96-9d2a-eb1215c69f8f-not-for-prod
clientSecret=super-secret-secret-that-should-be-regenerated-for-production
17 changes: 17 additions & 0 deletions tenant/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tenant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"@fusionauth/node-client": "^1.48.0",
"dotenv": "^16.3.2",
"prompt-sync": "^4.2.0",
"uuid": "^9.0.1"
}
Expand Down
16 changes: 12 additions & 4 deletions tenant/tenant-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ const uuid = require('uuid');
const { FusionAuthClient } = require('@fusionauth/node-client');
const prompt = require('prompt-sync')();
const fs = require('fs');
require('dotenv').config()

const appUrl = 'http://localhost';
const client = new FusionAuthClient('33052c8a-c283-4e96-9d2a-eb1215c69f8f-not-for-prod', 'http://localhost:9011');
const clientSecret = "super-secret-secret-that-should-be-regenerated-for-production";

const appUrl = process.env.APP_URL || 'http://localhost';
const FA_URL = process.env.FA_URL || 'http://localhost:9011';
const FA_API_KEY = process.env.FA_API_KEY || '33052c8a-c283-4e96-9d2a-eb1215c69f8f-not-for-prod';
const client = new FusionAuthClient(FA_API_KEY, FA_URL);
const clientSecret = process.env.clientSecret || "super-secret-secret-that-should-be-regenerated-for-production";

async function deleteTenant(tenantName) {
try {
Expand Down Expand Up @@ -91,9 +95,13 @@ function appendTenantToIngress(tenant, port) {
}

async function main() {
const tenant = prompt("Tenant name (key): ");
const tenant = prompt("Tenant: ");
const port = prompt("Port: ");
const backgroundColor = "#" + prompt("Background-Color: #");
if (!tenant || !port || !backgroundColor) {
console.log("Tenant, port and background-color are required");
return;
}
const { tenantId, applicationId } = await create(tenant);
console.log(`Created tenant ${tenant}`);
console.log(`- Tenant ID: ${tenantId}`);
Expand Down

0 comments on commit db5086e

Please sign in to comment.