Skip to content

Commit

Permalink
Merge branch 'trs/remove-nonsense-code'
Browse files Browse the repository at this point in the history
  • Loading branch information
tsibley committed Oct 13, 2023
2 parents 16efa97 + 54bdca7 commit 2117f6b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
4 changes: 1 addition & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import argparse from 'argparse';
import http from 'http';
import * as utils from './src/utils/index.js';

const version = utils.getGitHash();
const nextstrainAbout = `
Nextstrain is an open-source project to harness the scientific and public
health potential of pathogen genome data.
Expand All @@ -11,9 +10,8 @@ const nextstrainAbout = `
See https://github.com/nextstrain/nextstrain.org for more.
`;
const parser = new argparse.ArgumentParser({
version,
addHelp: true,
description: `Nextstrain.org server version ${version}`,
description: `Nextstrain.org server`,
epilog: nextstrainAbout
});
parser.addArgument('--verbose', {action: "storeTrue", help: "verbose server logging"});
Expand Down
15 changes: 0 additions & 15 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
import fs from 'fs';
import chalk from 'chalk';
import fetch from 'node-fetch';
import { NotFound } from '../httpErrors.js';


const getGitHash = () => {
/* https://stackoverflow.com/questions/34518389/get-hash-of-most-recent-git-commit-in-node */
try {
const rev = fs.readFileSync('.git/HEAD').toString();
if (rev.indexOf(':') === -1) {
return rev;
}
return fs.readFileSync('.git/').toString() + rev.substring(5).replace(/\n/, '');
} catch (err) {
return "unknown";
}
};

const verbose = (msg, ...rest) => {
if (global.verbose) {
console.log(chalk.greenBright(`[verbose]\t${msg}`), ...rest);
Expand Down Expand Up @@ -130,7 +116,6 @@ const normalizeHeaders = (headers) => {
};

export {
getGitHash,
verbose,
log,
warn,
Expand Down

0 comments on commit 2117f6b

Please sign in to comment.