Skip to content

Commit 0253bdb

Browse files
authored
chore: Add dev container (#377)
Signed-off-by: Dave Skender <[email protected]>
1 parent 4f1d58d commit 0253bdb

File tree

9 files changed

+2076
-1186
lines changed

9 files changed

+2076
-1186
lines changed

.devcontainer/devcontainer.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Stock Charts Dev Container",
3+
"image": "mcr.microsoft.com/dotnet/sdk:9.0",
4+
"features": {
5+
"ghcr.io/devcontainers/features/node:1": {
6+
"version": "lts"
7+
},
8+
"ghcr.io/devcontainers/features/git:1": {},
9+
"ghcr.io/devcontainers/features/github-cli:1": {},
10+
"ghcr.io/devcontainers/features/azure-cli:1": {},
11+
"ghcr.io/devcontainers-extra/features/angular-cli:2": {}
12+
},
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"ms-azuretools.vscode-azurefunctions",
17+
"ms-dotnettools.csharp",
18+
"angular.ng-template"
19+
]
20+
}
21+
},
22+
"settings": {
23+
"terminal.integrated.shell.linux": "/usr/bin/bash"
24+
},
25+
"postCreateCommand": "cd client && npm install",
26+
"remoteEnv": {
27+
"ALPACA_KEY": "${localEnv:ALPACA_KEY}",
28+
"ALPACA_SECRET": "${localEnv:ALPACA_SECRET}",
29+
"AzureWebJobsStorage": "${localEnv:AzureWebJobsStorage}"
30+
}
31+
}

README.md

+77-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you want to host on your local computer and review the source code, follow th
1919
- [Git](https://git-scm.com/) and [Node.js](https://nodejs.org/)
2020
- [Visual Studio](http://visualstudio.com)
2121

22-
### Steps
22+
### Steps to run
2323

2424
1. [Clone the repo](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
2525

@@ -57,6 +57,82 @@ setx ALPACA_SECRET "YOUR ALPACA SECRET KEY"
5757
setx AzureWebJobsStorage "UseDevelopmentStorage=true"
5858
```
5959

60+
## Using the Dev Container
61+
62+
This repository includes a Dev Container configuration to provide a consistent development environment. The Dev Container includes the following tools and dependencies:
63+
64+
- .NET SDK 9
65+
- Node LTS
66+
- NPM latest
67+
- GitHub CLI
68+
- Angular CLI
69+
- Azure Functions Core Tools
70+
- PowerShell
71+
- ESLint
72+
73+
### Steps to use Dev Container
74+
75+
1. Install [Visual Studio Code](https://code.visualstudio.com/) and the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
76+
77+
2. Clone the repository and open it in Visual Studio Code.
78+
79+
3. When prompted, reopen the repository in the Dev Container.
80+
81+
4. The Dev Container will be built and started automatically. You can now use the integrated terminal and other tools within the Dev Container.
82+
83+
### Environment Variables
84+
85+
The Dev Container includes the following environment variables:
86+
87+
- `ALPACA_KEY`
88+
- `ALPACA_SECRET`
89+
- `AzureWebJobsStorage`
90+
91+
These environment variables are required for fetching quote data from the Alpaca API and for local development and debugging of Azure Functions.
92+
93+
## Setting Up Azure Key Vault for Storing Secrets
94+
95+
To securely store and manage secrets such as `ALPACA_KEY` and `ALPACA_SECRET`, you can use Azure Key Vault. Follow the steps below to set up and use Azure Key Vault for storing secrets.
96+
97+
### Steps to use Azure Secrets
98+
99+
1. Create an Azure Key Vault in your Azure subscription.
100+
101+
2. Add the `ALPACA_KEY` and `ALPACA_SECRET` secrets to the Key Vault.
102+
103+
3. Update the application code to retrieve these secrets from Azure Key Vault during runtime.
104+
105+
4. Ensure that the necessary permissions are granted to the application to access the Key Vault.
106+
107+
5. Update the `local.settings.json` file in the `server/Functions` directory to include the `ALPACA_KEY` and `ALPACA_SECRET` environment variables.
108+
109+
6. Update the `README.md` to include instructions for setting up and using Azure Key Vault for storing secrets.
110+
111+
## Using User Secrets for Local Development
112+
113+
For local development, you can use User Secrets to store sensitive information such as `ALPACA_KEY` and `ALPACA_SECRET`. Follow the steps below to set up and use User Secrets for local development.
114+
115+
### Steps
116+
117+
1. In the `server/Functions` directory, run the following command to initialize User Secrets:
118+
119+
```bash
120+
dotnet user-secrets init
121+
```
122+
123+
2. Add the `ALPACA_KEY` and `ALPACA_SECRET` secrets to User Secrets:
124+
125+
```bash
126+
dotnet user-secrets set "ALPACA_KEY" "YOUR_ALPACA_API_KEY"
127+
dotnet user-secrets set "ALPACA_SECRET" "YOUR_ALPACA_SECRET_KEY"
128+
```
129+
130+
3. Update the application code to retrieve these secrets from User Secrets during runtime.
131+
132+
4. Ensure that the necessary permissions are granted to the application to access the User Secrets.
133+
134+
5. Update the `README.md` to include instructions for setting up and using User Secrets for local development.
135+
60136
## Contributing
61137

62138
This is an open-source project. If you want to report bugs, contribute fixes, or add new indicators, please review our [contributing guidelines](docs/CONTRIBUTING.md).

0 commit comments

Comments
 (0)