21 lines
857 B
JavaScript
21 lines
857 B
JavaScript
|
|
"use strict";
|
||
|
|
const test = require("node:test");
|
||
|
|
const assert = require("node:assert/strict");
|
||
|
|
const fs = require("node:fs");
|
||
|
|
const path = require("node:path");
|
||
|
|
const ini = fs.readFileSync(path.join(__dirname, "app.ini.template"), "utf8");
|
||
|
|
const unit = fs.readFileSync(path.join(__dirname, "guanghu-forgejo.service"), "utf8");
|
||
|
|
test("native Forgejo binds only to JD loopback", () => {
|
||
|
|
assert.match(ini, /HTTP_ADDR = 127\.0\.0\.1/);
|
||
|
|
assert.match(ini, /HTTP_PORT = 3001/);
|
||
|
|
});
|
||
|
|
test("registration and push-create are disabled", () => {
|
||
|
|
assert.match(ini, /DISABLE_REGISTRATION = true/);
|
||
|
|
assert.match(ini, /ENABLE_PUSH_CREATE_USER = false/);
|
||
|
|
});
|
||
|
|
test("secrets remain server-side placeholders", () => {
|
||
|
|
assert.equal((ini.match(/PRIVATE_SERVER_VALUE/g) || []).length, 2);
|
||
|
|
assert.doesNotMatch(ini, /[a-f0-9]{40,}/);
|
||
|
|
assert.match(unit, /User=git/);
|
||
|
|
});
|