Skip to content

Feat/disable redirect by env #6

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 3 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export CODER_ACCESS_URL="https://coder.access.url"
export CODER_HTTP_ADDRESS="0.0.0.0:3000" #If using nginx -> 127.0.0.1:3000
export CODER_PROVISIONER_DAEMONS=5
export CODER_TLS_ENABLE=false

export CODER_REDIRECT_TO_ACCESS_URL=false
export CODER_TELEMETRY_ENABLE=false
export CODER_OIDC_ENABLED=true
export CODER_OIDC_ISSUER_URL="https://oidc.issuer.url"
export CODER_OIDC_CLIENT_ID="your-oidc-client-id"
export CODER_OIDC_CLIENT_SECRET="your-oidc-client-secret"
export CODER_OIDC_SCOPES="openid email"
export CODER_OIDC_IGNORE_EMAIL_VERIFIED=true
export CODER_OIDC_REDIRECT_URI="$BASE_URL/api/v2/users/oidc/callback"
export CODER_OIDC_LOGOUT_URI="https://oidc.logout.url"
export CODER_OIDC_TOKEN_PATH="/home/ubuntu/.coder/tokens"

# if VITE_DISABLE_EXTERNAL_LOGIN_PAGE variable is true, CODER_DISABLE_PASSWORD_AUTH variable must be false
export VITE_DISABLE_EXTERNAL_LOGIN_PAGE=true
export CODER_DISABLE_PASSWORD_AUTH=false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ gotests.json
node_modules/
vendor/
yarn-error.log
.env

# VSCode settings.
**/.vscode/*
Expand Down
13 changes: 13 additions & 0 deletions site/src/@types/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference types="vite/client" />

interface ViteTypeOptions {
strictImportEnv: unknown
}

interface ImportMetaEnv {
readonly VITE_DISABLE_EXTERNAL_LOGIN_PAGE: string
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
6 changes: 5 additions & 1 deletion site/src/pages/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export const LoginPage: FC = () => {
/>
);
}
} else {
}

const disableExternalLoginPage = import.meta.env.VITE_DISABLE_EXTERNAL_LOGIN_PAGE === "true";

if (!isSignedIn && !disableExternalLoginPage) {
window.location.replace(`https://heaan.io`);
return null;
}
Expand Down
1 change: 1 addition & 0 deletions site/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default defineConfig({
// 'hidden' works like true except that the corresponding sourcemap comments in the bundled files are suppressed
sourcemap: "hidden",
},
envDir: "../",
define: {
"process.env": {
NODE_ENV: process.env.NODE_ENV,
Expand Down