Watchtower commited on
Commit ·
5169a81
1
Parent(s): 1444c0a
Deploy GitHub main 30390bd (PR #3: default URL fix)
Browse filesFiles changed (2)
82 unmodified lines8384858687888982 unmodified linesprivate memDevices = new MemoryDeviceStore();constructor(cfg: Config, opts: RuntimeOptions = {}) {for (const k of SETTING_KEYS) { const v = (cfg as Record<string, unknown>)[k]; if (typeof v === "string" && v) { this.values.set(k, v); } }this.persister = opts.persister;this.stripe = opts.stripe !== undefined ? opts.stripe : (cfg.STRIPE_SECRET_KEY ? makeStripe(cfg.STRIPE_SECRET_KEY) : null);if (opts.ledger) {82 unmodified lines8384858687888982 unmodified linesprivate memDevices = new MemoryDeviceStore();constructor(cfg: Config, opts: RuntimeOptions = {}) {for (const k of SETTING_KEYS) { const v = (cfg as Record<string, unknown>)[k]; if (typeof v === "string" && v && !(k.endsWith("_URL") && /^http:\/\/localhost[:/]/.test(v))) { this.values.set(k, v); } } // localhost defaults count as "not set"this.persister = opts.persister;this.stripe = opts.stripe !== undefined ? opts.stripe : (cfg.STRIPE_SECRET_KEY ? makeStripe(cfg.STRIPE_SECRET_KEY) : null);if (opts.ledger) {
109 unmodified lines110111112113114115109 unmodified linesconst r3 = await c.req("PUT", "/api/admin/settings", { values: { STRIPE_SECRET_KEY: SK }, persist: true });expect(r3.json.persisted).toBe(false); expect(r3.json.persistError).toMatch(/memory only/);});it("never logs secrets", async () => {const spies = (["log", "warn", "error", "info"] as const).map((m) => vi.spyOn(console, m).mockImplementation(() => {}));const { req, login } = boot(); await login();109 unmodified lines110111112113114115116117118119120109 unmodified linesconst r3 = await c.req("PUT", "/api/admin/settings", { values: { STRIPE_SECRET_KEY: SK }, persist: true });expect(r3.json.persisted).toBe(false); expect(r3.json.persistError).toMatch(/memory only/);});it("reports built-in localhost URL defaults as not configured", async () => {const { req, login } = boot(); await login();const st = (await req("GET", "/api/admin/settings")).json.settings;for (const k of ["STRIPE_SUCCESS_URL", "STRIPE_CANCEL_URL"]) expect(st.find((x: any) => x.key === k)).toMatchObject({ configured: false, value: "" });});it("never logs secrets", async () => {const spies = (["log", "warn", "error", "info"] as const).map((m) => vi.spyOn(console, m).mockImplementation(() => {}));const { req, login } = boot(); await login();
services/wallet/src/runtime.ts+1-1
services/wallet/test/admin.test.ts+5