private AgentServiceRegistration GetAgentService()

in client/Apache.ShenYu.Client/Registers/ShenyuConsulRegister.cs [89:117]


        private AgentServiceRegistration GetAgentService()
        {
            var props = this._shenyuOptions.Register.Props;
            //check data
            string appName = NormalizeForDns(props[Constants.RegisterConstants.Name]);
            string instanceId = NormalizeForDns(props[Constants.RegisterConstants.Id]);
            string portStr = props[Constants.RegisterConstants.Port];
            if (string.IsNullOrEmpty(portStr))
            {
                throw new System.ArgumentException("Port can not be null.");
            }
            string tagsStr = props[Constants.RegisterConstants.Tags];
            string[] tags = null ;
            if (!string.IsNullOrEmpty(tagsStr))
            {
                tags = tagsStr.Split(',');
            }
            string address = props.GetValueOrDefault(Constants.RegisterConstants.HostName,"localhost");
            _service = new AgentServiceRegistration
            {
                ID = instanceId,
                Name = appName,
                Tags = tags,
                Port = Int32.Parse(portStr),
                Address = address,
                EnableTagOverride = Boolean.Parse(props.GetValueOrDefault(Constants.RegisterConstants.EnableTagOverride, "false"))
            };
            return _service;
        }