Files
webstudio/apps/builder/app/services/trpc.server.ts
T
Ivan Starkov 393cc90612 build: Move build time env vars in env.static (#3183)
## Description

This variables are build time and not dependent on deploy. Moreover we
don't know them during production deploy.
But they are used as versioning at saas level 


## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-04-17 16:34:46 +03:00

18 lines
605 B
TypeScript

import { createTrpcProxyServiceClient } from "@webstudio-is/trpc-interface/index.server";
import env from "~/env/env.server";
import { staticEnv } from "~/env/env.static.server";
const TRPC_SERVER_URL = env.TRPC_SERVER_URL ?? "";
const TRPC_SERVER_API_TOKEN = env.TRPC_SERVER_API_TOKEN ?? "";
const GITHUB_REF_NAME = staticEnv.GITHUB_REF_NAME;
export const trpcSharedClient = createTrpcProxyServiceClient(
TRPC_SERVER_URL !== "" && TRPC_SERVER_API_TOKEN !== ""
? {
url: TRPC_SERVER_URL,
token: TRPC_SERVER_API_TOKEN,
branchName: GITHUB_REF_NAME,
}
: undefined
);