Ejemplo n.º 1
0
 private static void UpdateWithDefaultsForHost(EurekaServiceInfo si, EurekaInstanceOptions instOptions, string hostName)
 {
     UpdateWithDefaults(si, instOptions);
     instOptions.HostName   = hostName;
     instOptions.InstanceId = hostName + ":" + si.ApplicationInfo.InstanceId;
 }
Ejemplo n.º 2
0
        public static void UpdateConfiguration(IConfiguration config, EurekaServiceInfo si, EurekaInstanceOptions instOptions, IApplicationInstanceInfo appInfo)
        {
            if (instOptions == null)
            {
                return;
            }

            UpdateConfiguration(config, instOptions, appInfo);

            if (si == null)
            {
                return;
            }

            if (EurekaInstanceOptions.Default_Appname.Equals(instOptions.AppName))
            {
                instOptions.AppName = si.ApplicationInfo.ApplicationName;
            }

            if (string.IsNullOrEmpty(instOptions.RegistrationMethod) ||
                ROUTE_REGISTRATIONMETHOD.Equals(instOptions.RegistrationMethod, StringComparison.OrdinalIgnoreCase))
            {
                UpdateWithDefaultsForRoute(si, instOptions);
                return;
            }

            if (DIRECT_REGISTRATIONMETHOD.Equals(instOptions.RegistrationMethod, StringComparison.OrdinalIgnoreCase))
            {
                UpdateWithDefaultsForDirect(si, instOptions);
                return;
            }

            if (HOST_REGISTRATIONMETHOD.Equals(instOptions.RegistrationMethod, StringComparison.OrdinalIgnoreCase))
            {
                UpdateWithDefaultsForHost(si, instOptions, instOptions.HostName);
            }
        }