You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2020/06/09 15:52:07 UTC
[GitHub] [celix] abroekhuis commented on a change in pull request #249: Add env vars for bind/connect urls in pubsub
abroekhuis commented on a change in pull request #249:
URL: https://github.com/apache/celix/pull/249#discussion_r436637754
##########
File path: bundles/http_admin/http_admin/src/activator.c
##########
@@ -61,6 +61,15 @@ static int http_admin_start(http_admin_activator_t *act, celix_bundle_context_t
long prop_port_max = celix_bundleContext_getPropertyAsLong(ctx, HTTP_ADMIN_PORT_RANGE_MAX_KEY, HTTP_ADMIN_PORT_RANGE_MAX_DFT);
long num_threads = celix_bundleContext_getPropertyAsLong(ctx, HTTP_ADMIN_NUM_THREADS_KEY, HTTP_ADMIN_NUM_THREADS_DFT);
+ const char* listPortEnv = getenv(HTTP_ADMIN_LISTENING_PORTS_KEY);
Review comment:
please use the bundlecontext to get the property. If not found in the properties, it will check env as well.
##########
File path: bundles/pubsub/pubsub_utils/src/pubsub_utils.c
##########
@@ -180,4 +180,19 @@ char* pubsub_getMessageDescriptorsDir(celix_bundle_context_t* ctx, const celix_b
root = celix_bundle_getEntry(bnd, "META-INF/descriptors");
}
return root;
+}
+
+const char* pubsub_getEnvironmentVariableWithScopeTopic(const char *envVarName, const char *topic, const char *scope) {
+ char *envVar = malloc(512 * 1024);
+ memset(envVar, 0, 512 * 1024);
+ strncpy(envVar, envVarName, 512 * 1024);
+ strncat(envVar, topic, 256 * 1024 - 25);
+ if(scope != NULL) {
+ strncat(envVar, "_", 1);
+ strncat(envVar, scope, 256 * 1024 - 25);
+ }
+
+ char *ret = getenv(envVar);
Review comment:
use bundlecontext
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org