* fix: public env vars using decorator * fix: relocate * fix: use env.public * fix: register public env vars across plugins * fix: test * fix: tsc * fix: mark remaining ones as public * fix: move oidc ones to plugin * fix: prevent overwrite * fix: review
23 lines
679 B
TypeScript
23 lines
679 B
TypeScript
import { IntegrationType, PublicEnv } from "@shared/types";
|
|
import { Environment } from "@server/env";
|
|
import { Integration } from "@server/models";
|
|
|
|
// Note: This entire object is stringified in the HTML exposed to the client
|
|
// do not add anything here that should be a secret or password
|
|
export default function present(
|
|
env: Environment,
|
|
options: {
|
|
analytics?: Integration<IntegrationType.Analytics> | null;
|
|
rootShareId?: string | null;
|
|
} = {}
|
|
): PublicEnv {
|
|
return {
|
|
ROOT_SHARE_ID: options.rootShareId || undefined,
|
|
analytics: {
|
|
service: options.analytics?.service,
|
|
settings: options.analytics?.settings,
|
|
},
|
|
...env.public,
|
|
};
|
|
}
|