Skip to content

Commit 21348eb

Browse files
committed
Remove magic strings
1 parent 97ca88b commit 21348eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/collection-api/routes/metadata.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import yaml from 'js-yaml';
66

77
import Service from '../../archivist/services/service.js';
88

9+
const METADATA_FILENAME = 'metadata.yml';
10+
const PACKAGE_JSON_PATH = '../../../package.json';
11+
912
/**
1013
* @swagger
1114
* tags:
@@ -130,8 +133,8 @@ import Service from '../../archivist/services/service.js';
130133
export default async function metadataRouter(collectionPath, services) {
131134
const router = express.Router();
132135

133-
const STATIC_METADATA = yaml.load(await fs.readFile(path.join(collectionPath, '/metadata.yml'), 'utf8'));
134-
const { version: engineVersion } = JSON.parse(await fs.readFile(new URL('../../../package.json', import.meta.url)));
136+
const STATIC_METADATA = yaml.load(await fs.readFile(path.join(collectionPath, METADATA_FILENAME), 'utf8'));
137+
const { version: engineVersion } = JSON.parse(await fs.readFile(new URL(PACKAGE_JSON_PATH, import.meta.url)));
135138

136139
/**
137140
* @swagger

0 commit comments

Comments
 (0)