https://github.com/joeyguerra/dotnet-redis-starter
A dotnet core starter app that connects to Redis.
https://github.com/joeyguerra/dotnet-redis-starter
Last synced: 2 months ago
JSON representation
A dotnet core starter app that connects to Redis.
- Host: GitHub
- URL: https://github.com/joeyguerra/dotnet-redis-starter
- Owner: joeyguerra
- Created: 2021-08-19T01:47:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-31T20:23:08.000Z (almost 4 years ago)
- Last Synced: 2025-01-26T06:23:13.236Z (4 months ago)
- Language: C#
- Size: 79.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dotnet-Redis Starter App
Created a new project with `dotnet new console`.
# Redis
Create a container. You should only need to do this once.
The volume path has to be shared in Docker->Preferences->File Sharing.
```bash
# MacOS
docker create -v $(pwd)/redis-config:/usr/local/etc/redis --name myredis -p 6379:6379 redis redis-server /usr/local/etc/redis
``````powershell
# Windows
docker create -v ${pwd}/redis-config:/usr/local/etc/redis --name myredis -p 6379:6379 redis redis-server /usr/local/etc/redis
```Start the container.
```bash
docker start myredis
```# Run Tests
Note: The Redis password is externalized by setting an environment variable when starting the service per the [12 Factor App](https://12factor.net/config).
```bash
cd DotnetRedisStarter.Tests
RedisPassword= dotnet test
```Continously run the tests.
```bash
cd DotnetRedisStarter.Tests
RedisPassword= dotnet watch test
```## Windows
```powershell
cd DotnetRedisStarter.Tests
$env:RedisPassword=
dotnet test
```# Run App
Set a password in [redis.conf](https://github.com/joeyguerra/dotnet-redis-starter/blob/cab9806b419b9305c106e90017176c1f79309d6e/redis-config/redis-sample.conf#L790). This folder will get bind mounted to the Redis container per `docker create` command above.
```bash
dotnet run --project Reporter/Reporter.csproj RedisPassword=
```