Beispiel #1
0
 public static void Validate(ServiceControlConf config)
 {
     if (string.IsNullOrEmpty(config.Token))
     {
         throw new FormatException($"Failed to convert null or empty value to token");
     }
     if (!Utils.IsIPAddress(config.ListenAddress))
     {
         throw new FormatException($"Failed to convert {config.ListenAddress} to IP address");
     }
     if (!Utils.IsPort(config.Port))
     {
         throw new FormatException($"Failed to convert {config.Port} to port");
     }
 }
Beispiel #2
0
 public ServiceControl(IOptions <ServiceControlConf> options)
 {
     ServiceControlConf.Validate(options.Value);
     _options = options;
 }