skip to Main Content

Docker custom program stop

Look at this c program: #include <stdio.h> #include <unistd.h> #include <signal.h> int stop = 0; void handle_signal(int sig) { stop = 1; } void main() { signal(SIGINT, handle_signal); signal(SIGTERM, handle_signal); while (stop==0) { printf("Hellon"); sleep(1); } } I am compiling…

VIEW QUESTION

Telegram – Decide program running as Windows service / console cmd C# .NET

Basically I already try deciding using if else like this: static async Task Main(string[] args) { string licenseKey = Environment.GetEnvironmentVariable("LICENSE_KEY"); if (string.IsNullOrEmpty(licenseKey)) { Console.WriteLine("LICENSE_KEY not found."); return; } if (args.Contains("--console") || Environment.GetEnvironmentVariable("RUN_AS_SERVICE") != "true") { Console.WriteLine("Running as console."); var cancellationTokenSource…

VIEW QUESTION

Asp.net – How to use "TypedHttpClientFactory" with "AddHttpMessageHandler"?

I have some AuthorizationHandler that I register with a typed client: var clientFactory = services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>(); services.AddHttpClient<TypedClient>() .AddHttpMessageHandler(() => { var authorization = new BearerAuthorization(clientFactory, clientId, clientSecret, authHost, token); return new AuthorizationHandler(authorization); }); When I get the "TypedClient" directly through the…

VIEW QUESTION
Back To Top
Search