File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ HTDOCS="/usr/share/nginx/html/postguard"
66echo " Substituting SPA environment variables..."
77echo " VITE_FILEHOST_URL=${VITE_FILEHOST_URL} "
88
9- find " ${HTDOCS} " -name ' *.js' -type f -exec sed -i \
9+ find " ${HTDOCS} " -name ' *.js' -not -name ' config.js ' - type f -exec sed -i \
1010 -e " s|__VITE_FILEHOST_URL_PLACEHOLDER__|${VITE_FILEHOST_URL} |g" \
1111 {} +
1212
Original file line number Diff line number Diff line change 44 < meta charset ="utf-8 " />
55 < link rel ="icon " href ="%sveltekit.assets%/favicon.ico " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7+ < script src ="%sveltekit.assets%/config.js "> </ script >
78 %sveltekit.head%
89 </ head >
910 < body >
Original file line number Diff line number Diff line change 77 import Hamburger from ' $lib/components/header/Hamburger.svelte'
88 import { page } from ' $app/state' ;
99 import ThemeSwitcher from ' ./ThemeSwitcher.svelte'
10+ import { FF_BUSINESS } from ' $lib/env'
1011
11- let items = [
12+ const allItems = [
1213 { name: ' fs' , route: ' /fileshare' },
1314 { name: ' about' , route: ' /about' },
1415 { name: ' blog' , route: ' /blog' },
1718 { name: ' docs' , route: ' https://docs.postguard.eu' },
1819 ]
1920
21+ let items = FF_BUSINESS ? allItems : allItems .filter (i => i .name !== ' business' )
22+
2023 function isSelected(route : String ) {
2124 return page .url .pathname === route ;
2225 }
Original file line number Diff line number Diff line change @@ -13,3 +13,10 @@ export const UPLOAD_CHUNK_SIZE = Number(requireEnv('VITE_UPLOAD_CHUNK_SIZE'));
1313export const FILEREAD_CHUNK_SIZE = Number ( requireEnv ( 'VITE_FILEREAD_CHUNK_SIZE' ) ) ;
1414export const APP_NAME = requireEnv ( 'VITE_APP_NAME' ) ;
1515export const APP_VERSION = requireEnv ( 'VITE_APP_VERSION' ) ;
16+
17+ /** Runtime config injected by config.js (Terraform ConfigMap in deployed environments). */
18+ function runtimeConfig ( ) : Record < string , unknown > {
19+ return ( globalThis as any ) . APP_CONFIG ?? { } ;
20+ }
21+
22+ export const FF_BUSINESS = runtimeConfig ( ) . FF_BUSINESS === true ;
Original file line number Diff line number Diff line change 33 import { isLoading } from ' svelte-i18n'
44 import { _ } from ' svelte-i18n'
55 import { onMount } from ' svelte'
6+ import { FF_BUSINESS } from ' $lib/env'
67
78 let { children } = $props ()
89 let contactEl = $state <HTMLAnchorElement >()
4647 <ul >
4748 <li ><a href ="mailto:" bind:this ={contactEl } data-name ="info" data-domain ="postguard.eu" >{$_ (' footer.contact' )}</a ></li >
4849 <li ><a href =" https://github.com/encryption4all" >GitHub</a ></li >
49- <li ><a href =" https://business.postguard.eu" >PostGuard for Business</a ></li >
50+ { #if FF_BUSINESS } <li ><a href ="https://business.postguard.eu" >PostGuard for Business</a ></li >{ /if }
5051 </ul >
5152 </div >
5253 </div >
Original file line number Diff line number Diff line change 22 import { onMount } from ' svelte'
33 import { _ } from ' svelte-i18n'
44 import SEO from ' $lib/components/SEO.svelte'
5+ import { FF_BUSINESS } from ' $lib/env'
56
67 let contactEl: HTMLAnchorElement
78
5455 </div >
5556 </section >
5657
58+ {#if FF_BUSINESS }
5759 <section class =" business" >
5860 <div class =" business-content" >
5961 <h2 >{$_ (' landing.businessTitle' )}</h2 >
9092 <a href ="mailto:" bind:this ={contactEl } data-name ="info" data-domain ="postguard.eu" class ="business-cta" >{$_ (' landing.businessCta' )}</a >
9193 </div >
9294 </section >
95+ {/if }
9396</div >
9497
9598<style lang =" scss" >
Original file line number Diff line number Diff line change 1+ // Runtime configuration — overridden by Terraform ConfigMap in deployed environments.
2+ // Values here are defaults for local development.
3+ window . APP_CONFIG = {
4+ FF_BUSINESS : true ,
5+ } ;
You can’t perform that action at this time.
0 commit comments