Skip to content

Commit 1a95236

Browse files
authored
support env var for gh url, dont duplicate webhook secret (#2381)
1 parent ca4da58 commit 1a95236

File tree

7 files changed

+20
-12
lines changed

7 files changed

+20
-12
lines changed

helm-charts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ kubectl create namespace opentaco
1717
kubectl create secret generic ui-secrets \
1818
--from-env-file=.secrets/ui.env -n opentaco
1919

20-
kubectl create secret generic backend-secrets \
20+
kubectl create secret generic taco-orchestrator-secrets \
2121
--from-env-file=.secrets/digger-backend.env -n opentaco
2222

2323
kubectl create secret generic statesman-secrets \

ui/src/components/AddConnectionDialog.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import { GithubConnectButton } from "./GithubConnectButton"
1212
interface AddConnectionDialogProps {
1313
onBitbucketSubmit: (data: { type: string; bitbucket_webhook_secret: string; bitbucket_access_token: string }) => Promise<void>
1414
onGitlabSubmit: (data: { type: string; gitlab_webhook_secret: string, gitlab_access_token: string }) => Promise<void>
15+
githubAppUrl: string
1516
}
1617

17-
export function AddConnectionDialog({ onBitbucketSubmit, onGitlabSubmit }: AddConnectionDialogProps) {
18+
export function AddConnectionDialog({ onBitbucketSubmit, onGitlabSubmit, githubAppUrl }: AddConnectionDialogProps) {
1819
const [connectionType, setConnectionType] = useState("")
1920
const [webhookSecret, setWebhookSecret] = useState("")
2021
const [bitbucketAccessToken, setBitbucketAccessToken] = useState("")
@@ -37,7 +38,7 @@ export function AddConnectionDialog({ onBitbucketSubmit, onGitlabSubmit }: AddCo
3738
}
3839

3940
const handleGitHubConnect = async () => {
40-
window.location.href = "https://github.com/apps/digger-pro";
41+
window.location.href = githubAppUrl;
4142
};
4243

4344
return (
@@ -64,7 +65,7 @@ export function AddConnectionDialog({ onBitbucketSubmit, onGitlabSubmit }: AddCo
6465

6566
{connectionType === "github" && (
6667
<div className="mt-4 space-y-4">
67-
<p>To connect your GitHub repository, you need to install our <a href="https://github.com/apps/digger-pro" target="_blank" rel="noopener noreferrer">GitHub App</a>.</p>
68+
<p>To connect your GitHub repository, you need to install our <a href={githubAppUrl} target="_blank" rel="noopener noreferrer">GitHub App</a>.</p>
6869
<GithubConnectButton source="add_connection_dialog" onClick={handleGitHubConnect} />
6970
</div>
7071
)}

ui/src/components/GitHubConnection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Button } from "@/components/ui/button"
22

3-
export default function GitHubConnection() {
3+
export default function GitHubConnection({ githubAppUrl }: { githubAppUrl: string }) {
44
return (
55
<div className="space-y-4">
66
<p>To connect your GitHub repository, you need to install our GitHub App.</p>
77
<Button asChild>
8-
<a href="https://github.com/apps/digger-pro" target="_blank" rel="noopener noreferrer">
8+
<a href={githubAppUrl} target="_blank" rel="noopener noreferrer">
99
Install GitHub App
1010
</a>
1111
</Button>

ui/src/components/OnboardingSteps.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface OnboardingStepsProps {
3333
email: string
3434
organisationId: string
3535
publicHostname: string
36+
githubAppUrl: string
3637
}
3738

3839
interface WorkflowConfig {
@@ -42,7 +43,7 @@ interface WorkflowConfig {
4243
iacVersion: string
4344
}
4445

45-
export default function OnboardingSteps({ repoName, repoOwner, onComplete, userId, email, organisationId, publicHostname }: OnboardingStepsProps) {
46+
export default function OnboardingSteps({ repoName, repoOwner, onComplete, userId, email, organisationId, publicHostname , githubAppUrl}: OnboardingStepsProps) {
4647
const [currentStep, setCurrentStep] = useState(() => {
4748
if (typeof window !== 'undefined') {
4849
const step = new URLSearchParams(window.location.search).get('step')
@@ -183,7 +184,7 @@ jobs:
183184

184185

185186
const handleGithubConnect = () => {
186-
window.open("https://github.com/apps/digger-pro", "_blank")
187+
window.open(githubAppUrl, "_blank")
187188
setCurrentStep("workflow")
188189
setSteps(prev => ({ ...prev, githubConnected: true }))
189190
}

ui/src/lib/env.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type Env = {
1010
PUBLIC_HOSTNAME: string
1111
STATESMAN_BACKEND_URL: string
1212
WORKOS_REDIRECT_URI: string
13+
ORCHESTRATOR_GITHUB_APP_URL: string
1314
}
1415

1516
export const getPublicServerConfig = createServerFn({ method: 'GET' })
@@ -19,5 +20,6 @@ export const getPublicServerConfig = createServerFn({ method: 'GET' })
1920
PUBLIC_HOSTNAME: process.env.PUBLIC_URL?.replace('https://', '').replace('http://', '') ?? '',
2021
STATESMAN_BACKEND_URL: process.env.STATESMAN_BACKEND_URL ?? '',
2122
WORKOS_REDIRECT_URI: process.env.WORKOS_REDIRECT_URI ?? '',
23+
ORCHESTRATOR_GITHUB_APP_URL: process.env.ORCHESTRATOR_GITHUB_APP_URL ?? '',
2224
} as Env
2325
})

ui/src/routes/_authenticated/_dashboard/dashboard/onboarding.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ export const Route = createFileRoute(
1717
loader: async ({ context }) => {
1818
const { user, organisationId, publicServerConfig } = context
1919
const publicHostname = publicServerConfig?.PUBLIC_HOSTNAME || ''
20-
return { user, organisationId, publicHostname }
20+
const githubAppUrl = publicServerConfig?.ORCHESTRATOR_GITHUB_APP_URL || ''
21+
return { user, organisationId, publicHostname, githubAppUrl }
2122
},
2223
})
2324

2425
function RouteComponent() {
25-
const { user, organisationId, publicHostname } = Route.useLoaderData()
26+
const { user, organisationId, publicHostname, githubAppUrl } = Route.useLoaderData()
2627
const [repoInfo, setRepoInfo] = useState<RepoInfo | null>(null)
2728
const router = useRouter()
2829
const handleOnboardingComplete = () => {
@@ -46,6 +47,7 @@ function RouteComponent() {
4647
email={user?.email || ''}
4748
organisationId={organisationId || ''}
4849
publicHostname={publicHostname}
50+
githubAppUrl={githubAppUrl}
4951
onComplete={handleOnboardingComplete}
5052
/>
5153
) : (
@@ -54,6 +56,7 @@ function RouteComponent() {
5456
email={user?.email || ''}
5557
organisationId={organisationId || ''}
5658
publicHostname={publicHostname}
59+
githubAppUrl={githubAppUrl}
5760
onComplete={handleOnboardingComplete}
5861
/>
5962
)}

ui/src/routes/tfe/$.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async function handler({ request }) {
4848
if (!token) {
4949
return new Response('Unauthorized: No token provided', { status: 401 })
5050
}
51+
5152

5253
// Verify token against TOKEN SERVICE and extract user context
5354
let userId, userEmail, orgId;
@@ -108,9 +109,9 @@ async function handler({ request }) {
108109
}
109110

110111
// Use webhook auth to forward to internal TFE routes
111-
const webhookSecret = process.env.OPENTACO_ENABLE_INTERNAL_ENDPOINTS;
112+
const webhookSecret = process.env.STATESMAN_BACKEND_WEBHOOK_SECRET;
112113
if (!webhookSecret) {
113-
console.error('OPENTACO_ENABLE_INTERNAL_ENDPOINTS not configured');
114+
console.error('STATESMAN_BACKEND_WEBHOOK_SECRET not configured');
114115
return new Response('Internal configuration error', { status: 500 });
115116
}
116117

0 commit comments

Comments
 (0)