 9eb5967935
			
		
	
	9eb5967935
	
	
	
		
			
			* rework server responsibilities add remote configuration * start metrics only when compiled as not debug * add some more logging to discord bot * fixes of some casts * make metrics port configurable, minor fixes * add docker bullshit * md formatting * adjustments to docker stuff * fix docker json files, fix some stuff in discord bot, add /useradd for Discord bot * adjust docker configs and fix sharded.bat * fixes for logs, cache file provider repeat trying to open filestream Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
		
			
				
	
	
		
			30 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Grpc.Core;
 | |
| using MareSynchronosShared.Protos;
 | |
| using MareSynchronosShared.Utils;
 | |
| using Microsoft.AspNetCore.Authorization;
 | |
| using Microsoft.Extensions.Logging;
 | |
| using Microsoft.Extensions.Options;
 | |
| 
 | |
| namespace MareSynchronosShared.Services;
 | |
| 
 | |
| [Authorize]
 | |
| [AllowAnonymous]
 | |
| public class GrpcConfigurationService<T> : ConfigurationService.ConfigurationServiceBase where T : class, IMareConfiguration
 | |
| {
 | |
|     private readonly T _config;
 | |
|     private readonly ILogger<GrpcConfigurationService<T>> logger;
 | |
| 
 | |
|     public GrpcConfigurationService(IOptions<T> config, ILogger<GrpcConfigurationService<T>> logger)
 | |
|     {
 | |
|         _config = config.Value;
 | |
|         this.logger = logger;
 | |
|     }
 | |
| 
 | |
|     [AllowAnonymous]
 | |
|     public override Task<ValueMessage> GetConfigurationEntry(KeyMessage request, ServerCallContext context)
 | |
|     {
 | |
|         logger.LogInformation("Remote requested {key}", request.Key);
 | |
|         var returnVal = _config.SerializeValue(request.Key, request.Default);
 | |
|         return Task.FromResult(new ValueMessage() { Value = returnVal });
 | |
|     }
 | |
| } |