-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct login redirect issues in supabase implemetation x2 (#275)
- Loading branch information
Showing
4 changed files
with
28 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require("fs"); | ||
|
||
// check if script is running in netlify CI | ||
if (process.env.CI === "true") { | ||
console.log("Running in Netlify CI environment"); | ||
let base = process.env.URL; | ||
|
||
if (process.env.CONTEXT === "deploy-preview") { | ||
console.log("Running in Netlify deploy-preview environment"); | ||
|
||
base = `${process.env.DEPLOY_PRIME_URL}/`; | ||
} else { | ||
if (process.env.CHANNEL !== undefined && ["alpha", "beta"].includes(process.env.CHANNEL)) { | ||
console.log(`Running in Netlify ${process.env.CHANNEL} environment`); | ||
|
||
const {protocol, hostname} = new URL(process.env.URL); | ||
base = `${protocol}//${process.env.CHANNEL}.${hostname}/`; | ||
} | ||
} | ||
|
||
// write BASE_URL env variable to .env file | ||
fs.writeFileSync(".env.local", `NEXT_PUBLIC_BASE_URL=${base}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters