Skip to content

feat: Add portforward to the UI #3812

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

Merged
merged 8 commits into from
Sep 13, 2022
Prev Previous commit
Next Next commit
Add CODER_ENABLE_WILDCARD_APPS env var
  • Loading branch information
BrunoQuaresma committed Sep 6, 2022
commit ba52fedfdf3a5a9d74bc49962a0560ea885d4bfd
5 changes: 4 additions & 1 deletion site/src/components/PortForwardButton/PortForwardButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const PortForwardButton: React.FC<React.PropsWithChildren<PortForwardButt
const styles = useStyles()
const [port, setPort] = useState("3000")
const { location } = window
const urlExample = `${location.protocol}//${port}--${workspaceName}--${agentName}--${username}.${location.host}`
const urlExample =
process.env.CODER_ENABLE_WILDCARD_APPS === "true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be compiled by webpack, and isn't a dynamic environment variable at runtime. If we want to have a proper environment variable passed through, it'll have to come via the backend.

? `${location.protocol}//${port}--${workspaceName}--${agentName}--${username}.${location.host}`
: `${location.protocol}//${location.host}/@${username}/${workspaceName}/apps/${port}`

const onClose = () => {
setIsOpen(false)
Expand Down
4 changes: 4 additions & 0 deletions site/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ import { Configuration, EnvironmentPlugin } from "webpack"
const environmentPlugin = new EnvironmentPlugin({
INSPECT_XSTATE: "",
CODER_VERSION: "main",
CODER_ENABLE_WILDCARD_APPS: "",
})
console.info(`--- Setting INSPECT_XSTATE to '${process.env.INSPECT_XSTATE || ""}'`)
console.info(`--- Setting CODER_VERSION to '${process.env.CODER_VERSION || "main"}'`)
console.info(
`--- Setting CODER_ENABLE_WILDCARD_APPS to '${process.env.CODER_ENABLE_WILDCARD_APPS ?? ""}'`,
)
console.info(`--- Setting NODE_ENV to '${process.env.NODE_ENV || ""}'`)

/**
Expand Down