ByteSource function ( String arg0 , QueryOptions arg1 , Action < ? super Consul . Builder > arg2 ) { return Exceptions . uncheck ( ( ) -> ByteSource . wrap ( arg2 . with ( Consul . builder ( ) ) . build ( ) . keyValueClient ( ) . getValue ( arg0 , arg1 ) . transform ( v -> v . getValueAsString ( ) . or ( "srini_string" ) ) . or ( "srini_string" ) . getBytes ( ) ) ) ; }
read the specified key as a bytesource using the specified configuration to connection to consul and the provided queryoptions . the returned value can then be passed to the existing parsing options in ratpack.server.serverconfigbuilder to provide configuration . import ratpack.consul.ratpackconsulconfig ; import ratpack.test.embed.embeddedapp ; import com.orbitz.consul.option.immutablequeryoptions ; public class example public static class config public string name ; public string environment ; public string secret ; public static void main string ... args throws exception embeddedapp.of a - > a . serverconfig s - > s . yaml ratpackconsulconfig.value `` default/app '' . json ratpackconsulconfig.value `` default/environment '' , immutablequeryoptions.builder . token `` app-acl-token '' . build . props ratpackconsulconfig.value `` app/environment '' , b - > b.withurl `` https://consul.domain.io '' . require '' / config '' , config.class . handlers c - > c . get ctx - > ctx.render ctx.get config.class ; concode_field_sep PlaceHolder placeHolder concode_field_sep placeholderType placeHolder