nicolaferraro commented on a change in pull request #235: Support for multiple
integration definitions
URL: https://github.com/apache/camel-k/pull/235#discussion_r235687871
##########
File path: runtime/jvm/src/main/java/org/apache/camel/k/jvm/URIResolver.java
##########
@@ -16,36 +16,43 @@
*/
package org.apache.camel.k.jvm;
-import org.apache.camel.CamelContext;
-import org.apache.camel.util.ResourceHelper;
-
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
-import static org.apache.camel.k.jvm.Constants.SCHEME_INLINE;
+import org.apache.camel.CamelContext;
+import org.apache.camel.util.ResourceHelper;
+import org.apache.camel.util.StringHelper;
+
public class URIResolver {
- public static InputStream resolve(CamelContext ctx, String uri) throws
IOException {
+ public static InputStream resolve(CamelContext ctx, String uri) throws
Exception {
if (uri == null) {
throw new IllegalArgumentException("Cannot resolve null URI");
}
- if (uri.startsWith(SCHEME_INLINE)) {
+
+ if (uri.startsWith(Constants.SCHEME_ENV)) {
+ final String envvar = StringHelper.after(uri, ":");
+ final String content = System.getenv(envvar);
+
// Using platform encoding on purpose
- return new
ByteArrayInputStream(uri.substring(SCHEME_INLINE.length()).getBytes());
+ return new ByteArrayInputStream(content.getBytes());
}
return ResourceHelper.resolveMandatoryResourceAsInputStream(ctx, uri);
}
- public static Reader resolveInline(String uri) {
- if (!uri.startsWith(SCHEME_INLINE)) {
+ public static Reader resolveEnv(String uri) {
+ if (!uri.startsWith(Constants.SCHEME_ENV)) {
throw new IllegalArgumentException("The provided content is not
inline: " + uri);
Review comment:
`env`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services