public UModLogger(RustApiOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } _logLevel = options.LogLevel; _logToFile = options.LogToFile; }
/// <summary> /// Read options method. /// </summary> /// <param name="container">Services container.</param> /// <param name="configFileName">Configuration file name.</param> /// <returns></returns> private static RustApiOptions GetApiOptions(MicroContainer container) { var options = OptionsManager.ReadOptions <RustApiOptions>(ConfigFileName, container); if (options == default) { options = new RustApiOptions(DefaultEndpoint); OptionsManager.WriteOptions(ConfigFileName, options, container); } return(options); }
public ApiServer( RustApiOptions options, ILogger <ApiServer> logger, IAuthenticationService authenticationService, IApiRoutes apiRoutes) { _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _authenticationService = authenticationService ?? throw new ArgumentNullException(nameof(authenticationService)); _apiRoutes = apiRoutes ?? throw new ArgumentNullException(nameof(apiRoutes)); _listener = new HttpListener(); SetupListener(); }