usar nueva api para guardar config

This commit is contained in:
Cat /dev/Nulo 2023-02-16 21:38:49 -03:00
parent bcd0280e69
commit 28127eb3ec

View file

@ -1,10 +1,9 @@
import { buildForgejo } from "./build.js"; import { buildForgejo } from "./build.js";
import { Alpine } from "../../alpine.js"; import { Alpine } from "../../alpine.js";
import { Runit } from "../../runit/index.js"; import { Runit } from "../../runit/index.js";
import { writeFile } from "node:fs/promises";
import { join } from "node:path"; import { join } from "node:path";
import { loadForgejoSecretsFile } from "./secrets.js"; import { loadForgejoSecretsFile } from "./secrets.js";
import { sudoChown, sudoCopy, sudoWriteFile } from "../../helpers/sudo.js"; import { sudoCopy } from "../../helpers/sudo.js";
export async function setupForgejo(alpine: Alpine, runit: Runit) { export async function setupForgejo(alpine: Alpine, runit: Runit) {
const bin = await buildForgejo(); const bin = await buildForgejo();
@ -20,9 +19,8 @@ export async function setupForgejo(alpine: Alpine, runit: Runit) {
}); });
const secrets = await loadForgejoSecretsFile(); const secrets = await loadForgejoSecretsFile();
const configPath = join(alpine.dir, "/etc/forgejo.conf"); await alpine.writeFile(
await sudoWriteFile( "/etc/forgejo.conf",
configPath,
` `
; see https://docs.gitea.io/en-us/config-cheat-sheet/ for additional documentation. ; see https://docs.gitea.io/en-us/config-cheat-sheet/ for additional documentation.
@ -145,9 +143,8 @@ ALLOWED_HOST_LIST=external,loopback
REPO_INDEXER_ENABLED=true REPO_INDEXER_ENABLED=true
REPO_INDEXER_EXCLUDE=**.mp4,**.jpg REPO_INDEXER_EXCLUDE=**.mp4,**.jpg
`, `,
{ mode: 0o600 } entry
); );
await sudoChown(configPath, `${entry.uid}:${entry.gid}`);
await runit.addService( await runit.addService(
"forgejo", "forgejo",
`#!/bin/sh `#!/bin/sh