-
-
Notifications
You must be signed in to change notification settings - Fork 173
feat: opt. white-label #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# Automatically set PUBLIC_WHITE_LABEL based on WHITE_LABEL | ||
export PUBLIC_WHITE_LABEL="${WHITE_LABEL}" | ||
|
||
# Start the application | ||
exec "$@" |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better way would be do to do it in |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import seedSiteData from "../src/lib/server/db/seedSiteData.js"; | ||
import { config } from "dotenv"; | ||
config(); // Load .env variables | ||
const isWhiteLabeled = process.env.WHITE_LABEL === 'true'; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
|
@@ -12,6 +15,35 @@ export async function seed(knex) { | |
if (Object.prototype.hasOwnProperty.call(seedSiteData, key)) { | ||
let value = seedSiteData[key]; | ||
let data_type = typeof value; | ||
|
||
// Remove attribution from metaTags for initial db seeding (if white-labeled) | ||
if (key === "metaTags" && data_type === "object" && Array.isArray(value) && isWhiteLabeled) { | ||
value.forEach(item => { | ||
if (item.key === "twitter:site" || item.key === "twitter:creator") { | ||
item.value = "kener"; | ||
} | ||
}); | ||
} | ||
|
||
// Remove Documentation & Github nav links from initial db seeding (if white-labeled) | ||
if (key === "nav" && data_type === "object" && Array.isArray(value) && isWhiteLabeled) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should keep github and documentation as it will help people after they do 1 click deploy |
||
value = value.filter(item => item.name !== "Documentation" && item.name !== "Github"); | ||
} | ||
|
||
// Remove GA tracking ID/key from initial db seeding (if white-labeled) | ||
if (key === "analytics" && data_type === "object" && Array.isArray(value) && isWhiteLabeled) { | ||
const gaObject = value.find(item => item.type === 'GA'); | ||
if (gaObject) { | ||
gaObject.id = ""; | ||
} | ||
} | ||
|
||
// Remove 'Created by' text on initial db seeding (if white-labeled) | ||
if (key === "footerHTML" && isWhiteLabeled) { | ||
// value = value.replace(/<span data-white-label>.*?<\/span>/s, ""); // Remove <span data-white-label>...</span> | ||
value = ""; | ||
} | ||
|
||
if (data_type === "object") { | ||
value = JSON.stringify(value); | ||
} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of doing {env} in everyfile we can do it in src/routes/(docs)/+layout.server.js then you can use variable like |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should keep the documentation urls for easy access to what this page is about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not doing for non-docker deployment?
should it be just .env variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or in main.js