public static ConsulService buildService ( URL url ) { ConsulService service = new ConsulService ( ) ; service . setAddress ( url . getHost ( ) ) ; service . setId ( ConsulUtils . convertConsulSerivceId ( url ) ) ; service . setName ( url . getPath ( ) ) ; service . setPort ( url . getPort ( ) ) ; List < String > tags = new ArrayList < String > ( ) ; String env = url . getParameter ( Constants . TAG_ENVIRONMENT ) ; if ( env != null ) tags . add ( env ) ; service . setTags ( tags ) ; return service ; }
build consul service from url