Skip to content

Commit 9c9ed82

Browse files
Improve config for codespaces (#71)
1 parent 43d675a commit 9c9ed82

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

β€Ž.devcontainer/advanced-integration/devcontainer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
// For more details, see https://aka.ms/devcontainer.json.
22
{
33
"name": "PayPal Advanced Integration",
4-
"image": "mcr.microsoft.com/devcontainers/universal:2",
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
55
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
6-
76
// Use 'onCreateCommand' to run commands when creating the container.
87
"onCreateCommand": "bash ../.devcontainer/advanced-integration/welcome-message.sh",
9-
108
// Use 'postCreateCommand' to run commands after the container is created.
119
"postCreateCommand": "npm install",
12-
1310
// Use 'postAttachCommand' to run commands when attaching to the container.
1411
"postAttachCommand": {
1512
"Start server": "npm start"
1613
},
17-
1814
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1915
"forwardPorts": [
2016
8888
@@ -25,7 +21,6 @@
2521
"onAutoForward": "openBrowserOnce"
2622
}
2723
},
28-
2924
"secrets": {
3025
"PAYPAL_CLIENT_ID": {
3126
"description": "Sandbox client ID of the application.",
@@ -36,7 +31,6 @@
3631
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
3732
}
3833
},
39-
4034
"customizations": {
4135
"vscode": {
4236
"extensions": [
@@ -47,4 +41,4 @@
4741
}
4842
}
4943
}
50-
}
44+
}

β€Ž.devcontainer/advanced-integration/welcome-message.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WELCOME_MESSAGE="
77
88
πŸ› οΈ Your environment is fully setup with all the required software.
99
10-
πŸš€ Once you rename the \".env.example\" file to \".env\" and update \"CLIENT_ID\" and \"APP_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
10+
πŸš€ Once you rename the \".env.example\" file to \".env\" and update \"PAYPAL_CLIENT_ID\" and \"PAYPAL_CLIENT_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
1111

1212
ALTERNATE_WELCOME_MESSAGE="
1313
πŸ‘‹ Welcome to the \"PayPal Advanced Checkout Integration Example\"
@@ -16,7 +16,7 @@ ALTERNATE_WELCOME_MESSAGE="
1616
1717
πŸš€ The checkout page will automatically open in the browser after the server is started."
1818

19-
if [ -n "$CLIENT_ID" ] && [ -n "$APP_SECRET" ]; then
19+
if [ -n "$PAYPAL_CLIENT_ID" ] && [ -n "$PAYPAL_CLIENT_SECRET" ]; then
2020
WELCOME_MESSAGE="${ALTERNATE_WELCOME_MESSAGE}"
2121
fi
2222

β€Ž.devcontainer/standard-integration/devcontainer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
// For more details, see https://aka.ms/devcontainer.json.
22
{
33
"name": "PayPal Standard Integration",
4-
"image": "mcr.microsoft.com/devcontainers/universal:2",
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
55
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/standard-integration",
6-
76
// Use 'onCreateCommand' to run commands when creating the container.
87
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
9-
108
// Use 'postCreateCommand' to run commands after the container is created.
119
"postCreateCommand": "npm install",
12-
1310
// Use 'postAttachCommand' to run commands when attaching to the container.
1411
"postAttachCommand": {
1512
"Start server": "npm start"
1613
},
17-
1814
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1915
"forwardPorts": [
2016
8888
@@ -25,7 +21,6 @@
2521
"onAutoForward": "openBrowserOnce"
2622
}
2723
},
28-
2924
"secrets": {
3025
"PAYPAL_CLIENT_ID": {
3126
"description": "Sandbox client ID of the application.",
@@ -36,7 +31,6 @@
3631
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
3732
}
3833
},
39-
4034
"customizations": {
4135
"vscode": {
4236
"extensions": [
@@ -47,4 +41,4 @@
4741
}
4842
}
4943
}
50-
}
44+
}

β€Ž.devcontainer/standard-integration/welcome-message.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WELCOME_MESSAGE="
77
88
πŸ› οΈ Your environment is fully setup with all the required software.
99
10-
πŸš€ Once you rename the \".env.example\" file to \".env\" and update \"CLIENT_ID\" and \"APP_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
10+
πŸš€ Once you rename the \".env.example\" file to \".env\" and update \"PAYPAL_CLIENT_ID\" and \"PAYPAL_CLIENT_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
1111

1212
ALTERNATE_WELCOME_MESSAGE="
1313
πŸ‘‹ Welcome to the \"PayPal Standard Checkout Integration Example\"
@@ -16,7 +16,7 @@ ALTERNATE_WELCOME_MESSAGE="
1616
1717
πŸš€ The checkout page will automatically open in the browser after the server is started."
1818

19-
if [ -n "$CLIENT_ID" ] && [ -n "$APP_SECRET" ]; then
19+
if [ -n "$PAYPAL_CLIENT_ID" ] && [ -n "$PAYPAL_CLIENT_SECRET" ]; then
2020
WELCOME_MESSAGE="${ALTERNATE_WELCOME_MESSAGE}"
2121
fi
2222

β€ŽREADME.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,11 @@ Once you've setup a PayPal account, you'll need to obtain a **Client ID** and **
3838

3939
These examples will ask you to run commands like `npm install` and `npm start`.
4040

41-
You'll need a version of node >= 16 which can be downloaded from the [Node.js website](https://nodejs.org/en/download/).
41+
You'll need a version of node >= 16 which can be downloaded from the [Node.js website](https://nodejs.org/en/download/).
42+
43+
44+
### PayPal Codespaces Links
45+
| Application | Codespaces Link |
46+
| ---- | ---- |
47+
| Advanced Integration | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/paypal-examples/docs-examples?devcontainer_path=.devcontainer%2Fadvanced-integration%2Fdevcontainer.json)|
48+
| Standard Integration | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/paypal-examples/docs-examples?devcontainer_path=.devcontainer%2Fstandard-integration%2Fdevcontainer.json)|

0 commit comments

Comments
Β (0)