Browse Source

rm getGitInfo() from config.ts (#905)

Co-authored-by: Alexey Velikiy <av+1@corpglory.com>
pull/1/head
Coin de Gamma 4 years ago committed by GitHub
parent
commit
b3fee5807a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      server/src/config.ts

19
server/src/config.ts

@ -134,25 +134,6 @@ function getPackageVersion() {
}
}
function getGitInfo() {
let gitRoot = path.join(__dirname, '../../.git');
let gitHeadFile = path.join(gitRoot, 'HEAD');
if(!fs.existsSync(gitHeadFile)) {
console.error(`Can't find git HEAD file ${gitHeadFile}`);
return null;
}
const ref = fs.readFileSync(gitHeadFile).toString();
let branchPath = ref.indexOf(':') === -1 ? ref : ref.slice(5, -1);
let branch = branchPath.split('/').pop();
const branchFilename = `${gitRoot}/${branchPath}`;
if(!fs.existsSync(branchFilename)) {
console.error(`Can't find git branch file ${branchFilename}`);
return null;
}
let commitHash = fs.readFileSync(branchFilename).toString().slice(0, 7);
return { branch, commitHash };
}
// TODO: move to data_layer
function getDbConfig(connectionStr: string): DBConfig {
const [user, password] = connectionStr.split('@')[0].split(':');

Loading…
Cancel
Save