Skip to content

Commit

Permalink
Remove magic strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndpnt committed Dec 3, 2024
1 parent 97ca88b commit 21348eb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/collection-api/routes/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import yaml from 'js-yaml';

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

const METADATA_FILENAME = 'metadata.yml';
const PACKAGE_JSON_PATH = '../../../package.json';

/**
* @swagger
* tags:
Expand Down Expand Up @@ -130,8 +133,8 @@ import Service from '../../archivist/services/service.js';
export default async function metadataRouter(collectionPath, services) {
const router = express.Router();

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

/**
* @swagger
Expand Down

0 comments on commit 21348eb

Please sign in to comment.