Skip to content
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

Warn in local development when using non-local data server #196

Merged
merged 2 commits into from
Jul 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions website/src/components/website/WebsiteNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
<WebsiteNavBanner v-if="siteMode === 'staging'" class="bg-warning text-dark">
<b><a href="https://github.com/slmnio/slmngg-sfc" class="text-dark">Beta development version:</a></b> things may break. Use <a href="https://slmn.gg" class="text-dark font-weight-bold">slmn.gg</a> for the latest stable update.
</WebsiteNavBanner>
<WebsiteNavBanner v-if="siteMode === 'local'" class="bg-primary text-light">
SLMN.GG is running in local development mode.
<WebsiteNavBanner v-if="siteMode === 'local'" :class="dataServerMode === 'local' ? 'text-light bg-primary' : 'text-dark bg-warning'">
slmnio marked this conversation as resolved.
Show resolved Hide resolved
<span v-if="dataServerMode === 'local'">SLMN.GG is running in local development mode.</span>
<span v-else><i class="fas fa-exclamation-triangle fa-fw mr-1"></i> SLMN.GG is running in local development mode <strong>but not using a local data server.</strong></span>
</WebsiteNavBanner>
<!-- example: <WebsiteNavBanner class="bg-success" v-if="$socket.connected">Connected to the data server for live data updates!</WebsiteNavBanner>-->

Expand Down Expand Up @@ -148,6 +149,10 @@ export default {
siteMode() {
return import.meta.env.VITE_DEPLOY_MODE || import.meta.env.NODE_ENV;
},
dataServerMode() {
const dataServerURL = new URL(import.meta.env.VITE_DATA_SERVER);
return ["localhost", "127.0.0.1"].includes(dataServerURL.hostname) ? "local" : "remote";
},
navbarEvents() {
if (!this.minisite?.id) return [];
const events = ReactiveRoot(this.minisite.id, {
Expand Down