ken_nogi/NodeSrv/apps/app-portal/src/portalMeta.js
Kenichiro NOGI ce58cb4be4 初回コミット: dev配下(NodeSrv/Pleasanter等)をGitea管理下に統合
GitHub(nextgroup2706/ken_nogi)は今後使わず自社Gitea運用に切替え。
NodeSrvは旧リポジトリの履歴を破棄しファイルのみ統合(Dokploy用サービスアカウントは
別途mygit-admin/NodeSrv.gitに履歴あり)。notepmエクスポート(12GB)とPleasanter
インストーラzip(208MB)はサイズが大きいため.gitignoreで除外。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 15:37:06 +09:00

34 lines
938 B
JavaScript

function parseEnvString(envString) {
const result = {};
if (!envString) return result;
for (const line of envString.split('\n')) {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith('#')) continue;
const eqIndex = trimmed.indexOf('=');
if (eqIndex === -1) continue;
const key = trimmed.slice(0, eqIndex).trim();
const value = trimmed
.slice(eqIndex + 1)
.trim()
.replace(/^["']|["']$/g, '');
result[key] = value;
}
return result;
}
function extractPortalMeta(envString, fallbackLabel) {
const vars = parseEnvString(envString);
const appType = vars.PORTAL_APP_TYPE;
if (appType !== 'web' && appType !== 'batch') {
return null;
}
return {
appType,
label: vars.PORTAL_APP_LABEL || fallbackLabel,
url: vars.PORTAL_APP_URL || null,
triggerPath: vars.PORTAL_TRIGGER_PATH || null,
};
}
module.exports = { parseEnvString, extractPortalMeta };