fix: URLs Gitea correctes dans inventaire (recette/prod séparées), GITEA_RECETTE_PUBLIC
This commit is contained in:
@@ -479,6 +479,7 @@ module.exports = router;
|
|||||||
// ===== INVENTAIRE DES APPLICATIONS =====
|
// ===== INVENTAIRE DES APPLICATIONS =====
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
const GITEA_RECETTE_INTERNAL = process.env.GITEA_RECETTE_URL || 'http://gitea:3000';
|
const GITEA_RECETTE_INTERNAL = process.env.GITEA_RECETTE_URL || 'http://gitea:3000';
|
||||||
|
const GITEA_RECETTE_PUBLIC = process.env.GITEA_RECETTE_PUBLIC_URL || 'https://git.recette.santinova-soft.org';
|
||||||
const GITEA_PROD_EXTERNAL = 'https://git.santinova-soft.org';
|
const GITEA_PROD_EXTERNAL = 'https://git.santinova-soft.org';
|
||||||
const GITEA_USER_INV = process.env.GITEA_USERNAME || 'manus-admin';
|
const GITEA_USER_INV = process.env.GITEA_USERNAME || 'manus-admin';
|
||||||
const GITEA_PASS_REC = process.env.GITEA_PASSWORD || 'Itinova69!';
|
const GITEA_PASS_REC = process.env.GITEA_PASSWORD || 'Itinova69!';
|
||||||
@@ -497,7 +498,7 @@ const INVENTORY_APPS = [
|
|||||||
{ id: 'manus-dashboard', name: 'Dashboard Manus', repoName: 'manus-dashboard' },
|
{ id: 'manus-dashboard', name: 'Dashboard Manus', repoName: 'manus-dashboard' },
|
||||||
];
|
];
|
||||||
|
|
||||||
function curlGitea(baseUrl, owner, repo, pass) {
|
function curlGitea(baseUrl, owner, repo, pass, publicBaseUrl) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const auth = `${GITEA_USER_INV}:${pass}`;
|
const auth = `${GITEA_USER_INV}:${pass}`;
|
||||||
const cmd = `curl -sk --max-time 6 -u "${auth}" "${baseUrl}/api/v1/repos/${owner}/${repo}"`;
|
const cmd = `curl -sk --max-time 6 -u "${auth}" "${baseUrl}/api/v1/repos/${owner}/${repo}"`;
|
||||||
@@ -520,7 +521,8 @@ function curlGitea(baseUrl, owner, repo, pass) {
|
|||||||
version = sha && date ? `${sha} (${date})` : sha;
|
version = sha && date ? `${sha} (${date})` : sha;
|
||||||
}
|
}
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
resolve({ present: true, url: `${baseUrl}/${owner}/${repo}`, version });
|
const displayUrl = publicBaseUrl || baseUrl;
|
||||||
|
resolve({ present: true, url: `${displayUrl}/${owner}/${repo}`, version });
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
resolve({ present: false, url: null, version: null });
|
resolve({ present: false, url: null, version: null });
|
||||||
@@ -535,7 +537,7 @@ router.get('/inventory', authMiddleware, async (req, res) => {
|
|||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
INVENTORY_APPS.map(async (app) => {
|
INVENTORY_APPS.map(async (app) => {
|
||||||
const [repoRecette, repoProd] = await Promise.all([
|
const [repoRecette, repoProd] = await Promise.all([
|
||||||
curlGitea(GITEA_RECETTE_INTERNAL, owner, app.repoName, GITEA_PASS_REC),
|
curlGitea(GITEA_RECETTE_INTERNAL, owner, app.repoName, GITEA_PASS_REC, GITEA_RECETTE_PUBLIC),
|
||||||
curlGitea(GITEA_PROD_EXTERNAL, owner, app.repoName, GITEA_PASS_PRD),
|
curlGitea(GITEA_PROD_EXTERNAL, owner, app.repoName, GITEA_PASS_PRD),
|
||||||
]);
|
]);
|
||||||
return { ...app, repoRecette, repoProd };
|
return { ...app, repoRecette, repoProd };
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ services:
|
|||||||
- GITEA_URL=https://git.recette.santinova-soft.org
|
- GITEA_URL=https://git.recette.santinova-soft.org
|
||||||
- GITEA_USERNAME=manus-admin
|
- GITEA_USERNAME=manus-admin
|
||||||
- GITEA_PASSWORD=Itinova69!
|
- GITEA_PASSWORD=Itinova69!
|
||||||
- GITEA_RECETTE_URL=http://gitea:3000
|
- GITEA_RECETTE_URL=http://172.18.0.5:3000
|
||||||
- GITEA_PASSWORD_PROD=ManusGitea2026!
|
- GITEA_PASSWORD_PROD=ManusGitea2026!
|
||||||
- APPS_BASE_PATH=/opt/manus-deploy/apps
|
- APPS_BASE_PATH=/opt/manus-deploy/apps
|
||||||
- INFRA_BASE_PATH=/opt/manus-deploy/infrastructure
|
- INFRA_BASE_PATH=/opt/manus-deploy/infrastructure
|
||||||
|
|||||||
@@ -153,8 +153,11 @@ export default function InventairePage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Auto-refresh toutes les 5 minutes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchInventory();
|
fetchInventory();
|
||||||
|
const interval = setInterval(fetchInventory, 5 * 60 * 1000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user