Skip to content

Commit

Permalink
Switches posthog to use environment variables (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei authored Apr 30, 2024
1 parent 645f5c4 commit 5540a61
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 168 deletions.
209 changes: 69 additions & 140 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,157 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!--
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!--
Notice the use of %BASE_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%BASE_URL%favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
-->
<link
rel="icon"
type="image/png"
sizes="32x32"
href="%BASE_URL%favicon.ico"
/>
<script>
!(function (t, e) {
var o, n, p, r;
e.__SV ||
((window.posthog = e),
(e._i = []),
(e.init = function (i, s, a) {
function g(t, e) {
var o = e.split(".");
2 == o.length && ((t = t[o[0]]), (e = o[1])),
(t[e] = function () {
t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
});
}
((p = t.createElement("script")).type = "text/javascript"),
(p.async = !0),
(p.src = s.api_host + "/static/array.js"),
(r = t.getElementsByTagName("script")[0]).parentNode.insertBefore(
p,
r
);
var u = e;
for (
void 0 !== a ? (u = e[a] = []) : (a = "posthog"),
u.people = u.people || [],
u.toString = function (t) {
var e = "posthog";
return (
"posthog" !== a && (e += "." + a), t || (e += " (stub)"), e
);
},
u.people.toString = function () {
return u.toString(1) + ".people (stub)";
},
o =
"capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(
" "
),
n = 0;
n < o.length;
n++
)
g(u, o[n]);
e._i.push([i, s, a]);
}),
(e.__SV = 1));
})(document, window.posthog || []);
posthog.init("phc_yc5YUhGheWJL8XSKlLQJ9DYOH5Fi1IQyi7RB1TD4eyA", {
api_host: "https://app.posthog.com",
});
</script>
<title>Neosync</title>
<link rel="icon" type="image/png" sizes="32x32" href="%BASE_URL%favicon.ico" />
<title>Neosync</title>

<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2" as="font"
crossorigin="anonymous" />
<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2" as="font"
crossorigin="anonymous" />
<!-- SEE: https://docs.keycloakify.dev/limitations#self-hosted-fonts -->
<!-- Don't forget to import your custom fonts in Storybook as well: https://github.com/keycloakify/keycloakify-starter/blob/bb019e66fb09166cb9af1e24e230994f59daa420/src/keycloak-theme/login/createPageStory.tsx#L21 -->
<style>
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: normal;
/*400*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2") format("woff2");
}

/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2") format("woff2");
}

<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<!-- SEE: https://docs.keycloakify.dev/limitations#self-hosted-fonts -->
<!-- Don't forget to import your custom fonts in Storybook as well: https://github.com/keycloakify/keycloakify-starter/blob/bb019e66fb09166cb9af1e24e230994f59daa420/src/keycloak-theme/login/createPageStory.tsx#L21 -->
<style>
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: normal;
/*400*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2")
format("woff2");
}
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2") format("woff2");
}

/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2")
format("woff2");
}
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: bold;
/*700*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2") format("woff2");
}
</style>

/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2")
format("woff2");
}
<script>
!function (t, e) { var o, n, p, r; e.__SV || (window.posthog = e, e._i = [], e.init = function (i, s, a) { function g(t, e) { var o = e.split("."); 2 == o.length && (t = t[o[0]], e = o[1]), t[e] = function () { t.push([e].concat(Array.prototype.slice.call(arguments, 0))) } } (p = t.createElement("script")).type = "text/javascript", p.async = !0, p.src = s.api_host + "/static/array.js", (r = t.getElementsByTagName("script")[0]).parentNode.insertBefore(p, r); var u = e; for (void 0 !== a ? u = e[a] = [] : a = "posthog", u.people = u.people || [], u.toString = function (t) { var e = "posthog"; return "posthog" !== a && (e += "." + a), t || (e += " (stub)"), e }, u.people.toString = function () { return u.toString(1) + ".people (stub)" }, o = "capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "), n = 0; n < o.length; n++)g(u, o[n]); e._i.push([i, s, a]) }, e.__SV = 1) }(document, window.posthog || []);
posthog.init("%POSTHOG_KEY%", { api_host: "%POSTHOG_HOST%" })
</script>

/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: bold;
/*700*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2")
format("woff2");
}
</style>
<meta name="keycloakify-ignore-start" />
<script>
console.log(
"This is logged Only in the main app, stripped out in the theme"
);
</script>
<meta name="keycloakify-ignore-end" />
</head>

<meta name="keycloakify-ignore-start" />
<script>
console.log(
"This is logged Only in the main app, stripped out in the theme"
);
</script>
<meta name="keycloakify-ignore-end" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
28 changes: 2 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "neosync",
"homepage": "https://neosync.dev",
"version": "1.0.8",
"version": "1.0.9",
"description": "Auth templates for Neosync Cloud",
"repository": {
"type": "git",
Expand All @@ -21,7 +21,6 @@
"dependencies": {
"evt": "^2.5.7",
"keycloakify": "^9.5.3",
"posthog-js": "^1.118.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
4 changes: 4 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export default defineConfig({
react(),
commonjs(),
keycloakify({
extraThemeProperties: [
"POSTHOG_KEY=${env.POSTHOG_KEY:fake-key}",
"POSTHOG_HOST=${env.POSTHOG_HOST:https://app.posthog.com}"
]

// themeName: "keycloakify-starter",
// extraThemeProperties: [
Expand Down

0 comments on commit 5540a61

Please sign in to comment.