-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a234ba
commit f092e03
Showing
5 changed files
with
61 additions
and
15 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
STATIC_DIR="./public" | ||
HYPERSWITCH_PUBLISHABLE_KEY="GET_THIS_FROM_DASHBOARD" | ||
HYPERSWITCH_SECRET_KEY="GET_THIS_FROM_DASHBOARD" | ||
HYPERSWITCH_SERVER_URL="SERVER_URL" | ||
HYPERSWITCH_PUBLISHABLE_KEY="GET_PUBLISHABLE_KEY_FROM_DASHBOARD" | ||
HYPERSWITCH_SECRET_KEY="GET_SECRET_KEY_FROM_DASHBOARD" | ||
HYPERSWITCH_SERVER_URL="SELF_HOSTED_SERVER_URL" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require("fs"); | ||
const prompt = require("prompt-sync")({ sigint: true }); | ||
const publishableKey = prompt("Publishable Key : "); | ||
const secretKey = prompt("Secret Key : "); | ||
const serverURL = prompt("Server URL : "); | ||
|
||
const envPath = "./.env"; | ||
|
||
const publishableKeyDesc = "Publishable key added"; | ||
const secretKeyDesc = "Secret key added"; | ||
const serverURLDesc = "Server URL added"; | ||
|
||
function replace(filePath, oldLine, newLine, desc) { | ||
try { | ||
// Step 1: Read the file | ||
let data = fs.readFileSync(filePath, "utf8"); | ||
|
||
// Step 2: Replace the line | ||
data = data.replace(oldLine, newLine); | ||
|
||
// Step 3: Write the updated content back to the file | ||
fs.writeFileSync(filePath, data); | ||
|
||
console.log(`${desc} successfully.`); | ||
} catch (error) { | ||
console.error(`Error: ${error.message}`); | ||
} | ||
} | ||
|
||
replace( | ||
envPath, | ||
"GET_PUBLISHABLE_KEY_FROM_DASHBOARD", | ||
publishableKey, | ||
publishableKeyDesc | ||
); | ||
replace(envPath, "GET_SECRET_KEY_FROM_DASHBOARD", secretKey, secretKeyDesc); | ||
replace(envPath, "SELF_HOSTED_SERVER_URL", serverURL, serverURLDesc); |
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