Skip to content

Instantly share code, notes, and snippets.

View screamingworld's full-sized avatar

Markus Herkommer screamingworld

View GitHub Profile
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Notifier.WebApi</AssemblyName>
<RootNamespace>Notifier.WebApi</RootNamespace>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<OutputType>Exe</OutputType>
<UserSecretsId>notifier-webapi-6fd34aeb-1b78-4492-86dd-a5aa00ce38cd</UserSecretsId>
</PropertyGroup>
{
"ApplicationInsightsSettings": {
"InstrumentationKey": "<INSTRUMENTATION_KEY_AZURE_PORTAL>"
},
"AzureTableSettings": {
"ConnectionString": "<CONNECTION_STRING_AZURE_PORTAL>"
},
"EventHubSettings": {
"ConnectionString": "<CONNECTION_STRING_AZURE_PORTAL>"
}
using System;
namespace Notifier.WebApi.Models
{
public class NotificationModel
{
public string Message { get; set; }
public DateTime DateTime { get; set; }
}
}
using Notifier.WebApi.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Notifier.WebApi.Services
{
public interface INotificationService
{
Task CreateAndSendAsync(string message, CancellationToken cancellationToken);
using Google.Protobuf;
using Microsoft.Azure.EventHubs;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Notifier.Common;
using Notifier.Common.Settings;
using Notifier.WebApi.Common.Data;
using Notifier.WebApi.Common.Data.Entities;
using Notifier.WebApi.Models;
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json.Converters;
using Notifier.Common.Extensions;
using Notifier.Common.Settings;
using Notifier.WebApi.Common.Data;
using Notifier.WebApi.Common.Data.Entities;
{
"Logging": {
"LogLevel": {
"Default": "Information"
}
},
"ApplicationInsights": {
"InstrumentationKey": "<OVERRIDE IN USERSECRETS>"
},
"StorageSettings": {
@screamingworld
screamingworld / Dockerfile
Last active February 28, 2021 22:04
Notifier Web Api - Dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["./WebApi/Notifier.WebApi/Notifier.WebApi.csproj", "src/WebApi/Notifier.WebApi/"]
COPY ["./Common/Notifier.Common/Notifier.Common.csproj", "src/Common/Notifier.Common/"]
RUN dotnet restore "src/WebApi/Notifier.WebApi/Notifier.WebApi.csproj"
COPY . .
WORKDIR "/src/WebApi/Notifier.WebApi"
@screamingworld
screamingworld / config.yaml
Created February 28, 2021 22:38
Notifier - k8s config
apiVersion: v1
kind: ConfigMap
metadata:
name: notifier-webapi-config
labels:
area: Notifier
component: WebApi
data:
CorsOptions__AllowedOrigins: 'https://notifier-webapi#{DOMAIN_URL_SUFFIX}#.#{DOMAIN_URL_BASE_NAME}#'
@screamingworld
screamingworld / secrets.yaml
Created February 28, 2021 22:44
Notifier - k8s secrets
apiVersion: v1
kind: Secret
metadata:
name: notifier-webapi-secret
type: Opaque
stringData:
ApplicationInsights__InstrumentationKey: '#{ApplicationInsights__InstrumentationKey}#'
StorageSettings__ConnectionString: '#{StorageSettings__ConnectionString}#'
EventHubSettings__ConnectionString: '#{EventHubSettings__ConnectionString}#'