Skip to content

Commit

Permalink
replace shopify redirect_urls
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Jan 10, 2025
1 parent 6bf521c commit 91f677b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fly.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ GDF.extend(class extends GDF {
// update config for Shopify apps
flyShopifyConfig(app) {
const original = fs.readFileSync('shopify.app.toml', 'utf-8')
const config = original.replaceAll(/"https:\/\/[-\w.]+/g, `"https://${app}.fly.dev`)
const url = `"https://${app}.fly.dev`
const config = original.replaceAll(/"https:\/\/[-\w.]+/g, url)
.replace(/(redirect_urls\s*=\s*\[).*?\]/s,
`$1\n ${url}/auth/callback\n ${url}/auth/shopify/callback\n ${url}/api/auth/callback\n]`)
if (original !== config) {
console.log(`${chalk.bold.green('update'.padStart(11, ' '))} shopify.app.toml`)
fs.writeFileSync('shopify.app.toml', config)
Expand Down

0 comments on commit 91f677b

Please sign in to comment.