identity/asset-api/src/consts.js

43 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-06-30 16:46:35 +00:00
// Identity. Store your memories and mental belongings
// Copyright (C) 2024 Sofía Aritz
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import "dotenv/config";
const REQUIRED_VARS = [
"ASSET_API_ASSETS_FOLDER",
2024-06-30 17:03:38 +00:00
"ASSET_API_IDENTITY_API_ENDPOINT",
"ASSET_API_PRIVATE_KEY_PATH",
"ASSET_API_PUBLIC_KEY_PATH",
2024-06-30 16:46:35 +00:00
];
REQUIRED_VARS.forEach((element) => {
if (
process.env[element] == null ||
(typeof process.env[element] === "string" && process.env[element].length === 0)
) {
console.error(`Required environment variable was not set: ${element}`);
process.exit(1);
}
});
export const ASSET_API_LANDING_MESSAGE = process.env["ASSET_API_LANDING_MESSAGE"] || "asset-api v0.0.1";
export const LISTEN_PORT = Number(process.env["ASSET_API_LISTEN_PORT"]) || 3001;
export const ASSETS_FOLDER = process.env["ASSET_API_ASSETS_FOLDER"];
export const IDENTITY_API_ENDPOINT = process.env["ASSET_API_IDENTITY_API_ENDPOINT"];
export const M2M_ALGORITHM = process.env["ASSET_API_M2M_ALGORITHM"] || "RSA-SHA512";
2024-06-30 20:05:06 +00:00
export const PRIVATE_KEY_PATH = process.env["ASSET_API_PRIVATE_KEY_PATH"];
export const PUBLIC_KEY_PATH = process.env["ASSET_API_PUBLIC_KEY_PATH"];