John-Cassidy / Restore

e-commerce store with .Net, React & Redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restore

e-commerce store with .Net, React & Redux

Udemy Course Course GitHub Repo

GitHub Action Badges

build and test

Dev Container(s)

Configured devcontainer.json to create container to run both:

  • .NET 8 WebApi solution - port 5000
  • React 18 client application - port 3000
  • PostgreSQL DB - [standard postgresql port]

Devcontainer Setup with PostgreSQL DB

PostgreSQL Image

Create Devcontainer

Developing Inside Container

Extension: Visual Studio Code Dev Containers

Getting Started with .NET 8 DevContainer

Example Setup

Securely Manage Secrets in Devcontainer using Environment Variables

To securely manage secrets in your devcontainer using environment variables, you can use a .env file. This file should not be checked into source control, and it should be used to store your secrets. Here's how you can do it:

  1. Create a .env file in your local workspace (the same directory as your devcontainer.json and docker-compose.yml files). This file should contain your secrets in the form of environment variables:
SECRET_KEY=your_secret_key
ANOTHER_SECRET=another_secret

In your docker-compose.yml file, you can use the env_file directive to load the environment variables from the .env file:

services:
  app:
    env_file:
      - .env

In your devcontainer.json file, you can reference these environment variables in the remoteEnv section:

{
  "remoteEnv": {
    "ASPNETCORE_ENVIRONMENT": "Development",
    "DOTNET_USE_POLLING_FILE_WATCHER": "true",
    "TARGET": "net8.0",
    "SECRET_KEY": "${localEnv:SECRET_KEY}",
    "ANOTHER_SECRET": "${localEnv:ANOTHER_SECRET}"
  }
}

This way, your secrets are loaded into the environment of the devcontainer, but they are not checked into source control. Make sure to add .env to your .gitignore file to prevent it from being accidentally committed.

About

e-commerce store with .Net, React & Redux


Languages

Language:C# 64.4%Language:TypeScript 34.7%Language:Dockerfile 0.6%Language:JavaScript 0.2%Language:HTML 0.1%