First Commit. Duplicate bunext-sqlite preset
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { AppData } from "./app-data";
|
||||
import { SiteData } from "./site-data";
|
||||
|
||||
describe("AppData auth constants", () => {
|
||||
test("cookie names are derived from the site slug", () => {
|
||||
expect(AppData["AuthKeyCookieName"]).toBe(
|
||||
`${SiteData["SiteSlug"]}_auth_key`,
|
||||
);
|
||||
expect(AppData["AuthCSRFCookieName"]).toBe(
|
||||
`${SiteData["SiteSlug"]}_auth_csrf`,
|
||||
);
|
||||
expect(AppData["SSOAuthCookieName"]).toBe(
|
||||
`${SiteData["SiteSlug"]}_sso_auth`,
|
||||
);
|
||||
});
|
||||
|
||||
test("expiry and limits are positive", () => {
|
||||
expect(AppData["AuthExpiryDays"]).toBeGreaterThan(0);
|
||||
expect(AppData["SSOCodeExpiryMinutes"]).toBeGreaterThan(0);
|
||||
expect(AppData["DefaultQueryLimit"]).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test("has a configured health message", () => {
|
||||
expect(AppData["ServerHealthMessage"]).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import { SiteData } from "./site-data";
|
||||
|
||||
export const AppData = {
|
||||
HashCost: 12,
|
||||
SSOAuthCookieName: `${SiteData["SiteSlug"]}_sso_auth`,
|
||||
SSOCodeExpiryMinutes: 15,
|
||||
SSOPendingLoginMaxMinutes: 60,
|
||||
SSOPendingLoginStorageKey: `${SiteData["SiteSlug"]}_sso_pending_login`,
|
||||
ServerHealthMessage: "Server Running Well",
|
||||
AuthKeyCookieName: `${SiteData["SiteSlug"]}_auth_key`,
|
||||
AuthCSRFCookieName: `${SiteData["SiteSlug"]}_auth_csrf`,
|
||||
AuthExpiryDays: 60,
|
||||
APICrudBasePath: "/api/admin/crud",
|
||||
ForcePrivateHeaderKey: `x-${SiteData["SiteSlug"]}-force-private`,
|
||||
ForcePublicHeaderKey: `x-${SiteData["SiteSlug"]}-force-public`,
|
||||
DefaultQueryLimit: 40,
|
||||
MainImageSize: 500,
|
||||
MaxImageWidth: 1500,
|
||||
ImageThumbnailSize: 150,
|
||||
ImageQuality: 85,
|
||||
ImageThumbnailQuality: 70,
|
||||
PaystackEndpoint: "https://api.paystack.co",
|
||||
SSOMaxCodeAttempts: 5,
|
||||
SSOCodeRequestLimit: 5,
|
||||
ContactFormLimit: 5,
|
||||
RateLimitWindowMinutes: 15,
|
||||
UsernameRegex: /^[a-z0-9._-]{3,32}$/,
|
||||
PasswordMinLength: 8,
|
||||
PasswordMaxLength: 128,
|
||||
PasswordAttemptLimit: 10,
|
||||
} as const;
|
||||
@@ -0,0 +1,5 @@
|
||||
export const SiteData = {
|
||||
SiteName: `Bun SQLite Preset`,
|
||||
SiteURL: `http://localhost:7247`,
|
||||
SiteSlug: `bsqlite`,
|
||||
} as const;
|
||||
Reference in New Issue
Block a user