fix: git-info error message

This commit is contained in:
Rafael Cárdenas
2021-12-15 09:55:51 -06:00
committed by GitHub
parent 28ebe2d1eb
commit 61f6e7c27a

View File

@@ -84,6 +84,13 @@ function getConfiguredChainID() {
}
async function init(): Promise<void> {
if (isProdEnv && !fs.existsSync('.git-info')) {
throw new Error(
'File not found: .git-info. This generated file is required to display the running API version in the ' +
'`/extended/v1/status` endpoint. Please execute `npm run build` to regenerate it.'
);
}
let db: DataStore;
if ('STACKS_API_OFFLINE_MODE' in process.env) {
db = OfflineDummyStore;
@@ -162,10 +169,6 @@ async function init(): Promise<void> {
}
}
if (isProdEnv && !fs.existsSync('.git-info')) {
throw new Error(`Git info file not found`);
}
const apiServer = await startApiServer({ datastore: db, chainId: getConfiguredChainID() });
logger.info(`API server listening on: http://${apiServer.address}`);
registerShutdownConfig({