Browse Source

fix: Remove credentials from project info API

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/341/head
Pranav C 3 years ago
parent
commit
9f2ec01384
  1. 10
      packages/nocodb/src/lib/sqlMgr/SqlMgr.ts

10
packages/nocodb/src/lib/sqlMgr/SqlMgr.ts

@ -172,6 +172,7 @@ export default class SqlMgr {
args.folder = slash(this.currentProjectFolder); args.folder = slash(this.currentProjectFolder);
const projectJson = {...this.currentProjectJson, envs: {...this.currentProjectJson.envs}}; const projectJson = {...this.currentProjectJson, envs: {...this.currentProjectJson.envs}};
// delete db credentials
for (const env of Object.keys(projectJson.envs)) { for (const env of Object.keys(projectJson.envs)) {
projectJson.envs[env] = {...projectJson.envs[env], db: [...projectJson.envs[env].db]} projectJson.envs[env] = {...projectJson.envs[env], db: [...projectJson.envs[env].db]}
for (let i = 0; i < projectJson.envs[env].db.length; i++) { for (let i = 0; i < projectJson.envs[env].db.length; i++) {
@ -181,10 +182,16 @@ export default class SqlMgr {
database: projectJson.envs[env].db[i].connection.database database: projectJson.envs[env].db[i].connection.database
} }
} }
} }
} }
// remove meta db credentials
if (projectJson.meta?.db) delete projectJson.meta.db;
// remove auth credentials
delete projectJson.auth;
args.projectJson = projectJson; args.projectJson = projectJson;
data.data.list[0] = args; data.data.list[0] = args;
return data; return data;
@ -1065,7 +1072,6 @@ export default class SqlMgr {
} }
public async projectChangeEnv(args) { public async projectChangeEnv(args) {
try { try {
const xcConfig = JSON.parse(fs.readFileSync(path.join(this.currentProjectFolder, 'config.xc.json'), 'utf8')); const xcConfig = JSON.parse(fs.readFileSync(path.join(this.currentProjectFolder, 'config.xc.json'), 'utf8'));

Loading…
Cancel
Save