Let Cloudron turn on named admins, the ops token, and Umami after the image is built.
Tracker env is read at request time and the CSP already allows the analytics host, so staging can set a rule admin, an ops bearer token, and the cookieless Umami site without rebuilding.
This commit is contained in:
1 parent
36112f95d3
commit
f7d88a7d5c
9 files changed
+132
-49
No files matched your search
@@ -12,6 +12,9 @@ describe("security headers", () => {
|
||||
);
|
||||
expect(byKey["Content-Security-Policy"]).toContain("default-src 'self'");
|
||||
expect(byKey["Content-Security-Policy"]).toContain("script-src 'self'");
|
||||
expect(byKey["Content-Security-Policy"]).toContain(
|
||||
"https://analytics.communityrule.info",
|
||||
);
|
||||
expect(byKey["Content-Security-Policy"]).toContain("style-src 'self'");
|
||||
expect(byKey["Content-Security-Policy"]).toContain("font-src 'self'");
|
||||
expect(byKey["Content-Security-Policy"]).toContain("img-src 'self'");
|
||||
|
||||
@@ -38,4 +38,17 @@ describe("umamiTracker", () => {
|
||||
process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID = "site-1";
|
||||
expect(umamiTracker()).toBeNull();
|
||||
});
|
||||
|
||||
it("reads env at call time so Cloudron can set it after the image is built", () => {
|
||||
delete process.env.NEXT_PUBLIC_UMAMI_SRC;
|
||||
delete process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID;
|
||||
expect(umamiTracker()).toBeNull();
|
||||
process.env.NEXT_PUBLIC_UMAMI_SRC =
|
||||
"https://analytics.communityrule.info/script.js";
|
||||
process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID = "staging-site";
|
||||
expect(umamiTracker()).toEqual({
|
||||
src: "https://analytics.communityrule.info/script.js",
|
||||
websiteId: "staging-site",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user