From 91f677bc66b90a31dda18d3986553b71b1ef6c97 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Fri, 10 Jan 2025 09:33:29 -0500 Subject: [PATCH] replace shopify redirect_urls --- fly.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fly.js b/fly.js index f212828..9972753 100755 --- a/fly.js +++ b/fly.js @@ -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)