Coder Social home page Coder Social logo

netcore-seed's People

Contributors

joni7777 avatar

Watchers

 avatar  avatar

Forkers

meir017

netcore-seed's Issues

[feature] Add configuration handler, with environments overwrites

Need to implement config service, that loads the configuration from the config dir and overwrite the configuration by environments

config\

  • default.json
  • development.json
  • production.json
  • development.local.json

with c# env development the configs will be read by the following order:
default.json -> development.json -> development.local.json
creating unioned configuration

[feature] use serilog and create an mattermost sink

we just need to implement this interface ILogEventSink

maybe something like this:

public abstract class HttpSink : ILogEventSink
{
    private readonly HttpClient _httpClient;

    protected virtual HttpMethod HttpMethod { get; } = HttpMethod.Post;

    protected HttpSink(HttpClient httpClient) => _httpClient = httpClient;

    public void Emit(LogEvent logEvent)
    {
        var request = new HttpRequestMessage(HttpMethod, GenerateRequestUri(logEvent))
        {
            Content = GenerateRequestBody(logEvent)
        };
        _httpClient.SendAsync(request);
    }

    protected abstract string GenerateRequestUri(LogEvent logEvent);
    protected abstract HttpContent GenerateRequestBody(LogEvent logEvent);
}

public class MattermostHttpSink : HttpSink
{
    private readonly string _mattermostHookUrl;
    public MattermostHttpSink(HttpClient httpClient, string mattermostHookUrl) : base(httpClient)
    {
        _mattermostHookUrl = mattermostHookUrl;
    }

    protected override HttpContent GenerateRequestBody(LogEvent logEvent)
    {
        logEvent.Properties.TryGetValue("swaggerOperationId", out var swaggerOperationId);
        logEvent.Properties.TryGetValue("serviceName", out var serviceName);

        var mattermostMessage = "...";

        var builder = new StringBuilder();
        builder.Append('{');
        builder.Append("\"username\":\"").Append(serviceName).Append("\",");
        builder.Append("\"text\":\"").Append(mattermostMessage).Append("\"");
        builder.Append("\"");
        builder.Append('}');
        return new StringContent(builder.ToString(), Encoding.UTF8, "application/json");
    }
    protected override string GenerateRequestUri(LogEvent logEvent) => _mattermostHookUrl;
}

[feature] Add endpointer and swagger-client

Create endpointer and swagger-client services to allow using other microservices by service name, and operation id on the service

Current idea for implementing the abillity to have swagger client for different services:

Creating nuget package named: Bp.Endpointer
the package reads the config for the endpointer url
have register method

Each service should be a nuget package compiled with AutoRest based on the swagger.json file, and after generating the SDK for javascript, typescript, C# - the output will be uploaded to nuget source and npm source so every service will be a package and the c# sdk will extension method of the nuget package Bp.Endpointer

for example

var loginResponse = await Bp.Endpointer.AuthService.Login("username", "password");

This issue requires creating package.json script for generating sdk and dotnet script as well
the script will also publish the current sdk files to the npm, nuget under as Bp.ServiceName with version from the service config and the branch name, and if the branch is mater it will uploaded without the branch name

also to add a git hook for each service that on push to the master to run the script

and like this, every service that wants to connect with another will install the Bp.Endpointer and the Bp.ServiceName

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.