aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------app-controller-submodule0
-rw-r--r--src/aft.c26
2 files changed, 21 insertions, 5 deletions
diff --git a/app-controller-submodule b/app-controller-submodule
-Subproject 4e30eb1444fc88b73582db421d3a7467a364706
+Subproject 9ba5c8f531fc371d5402ea28467029bd3e95f98
diff --git a/src/aft.c b/src/aft.c
index df0c69b..0114e8f 100644
--- a/src/aft.c
+++ b/src/aft.c
@@ -191,26 +191,41 @@ static int CtrlCreateApi(AFB_ApiT apiHandle, CtlConfigT *ctrlConfig) {
int afbBindingEntry(afb_api_t apiHandle) {
size_t len = 0, bindingRootDirLen = 0;
- char *dirList;
+ char *dirList, *afTestRootDir, *path;
const char *envDirList = NULL, *configPath = NULL, *bindingRootDir = NULL;
+ json_object *settings = afb_api_settings(apiHandle), *bpath = NULL;
AFB_default = apiHandle;
AFB_ApiDebug(apiHandle, "Controller in afbBindingEntry");
+ if(json_object_object_get_ex(settings, "binding-path", &bpath)) {
+ afTestRootDir = strdup(json_object_get_string(bpath));
+ path = rindex(afTestRootDir, '/');
+ if(strlen(path) < 3)
+ return ERROR;
+ *++path = '.';
+ *++path = '.';
+ *++path = '\0';
+ }
+ else {
+ afTestRootDir = malloc(1);
+ strcpy(afTestRootDir, "");
+ }
+
envDirList = getEnvDirList(CONTROL_PREFIX, "CONFIG_PATH");
bindingRootDir = GetBindingDirPath();
bindingRootDirLen = strlen(bindingRootDir);
if(envDirList) {
- len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen + 2;
+ len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen + 3;
dirList = malloc(len + 1);
- snprintf(dirList, len +1, "%s:%s:%s", envDirList, bindingRootDir, CONTROL_CONFIG_PATH);
+ snprintf(dirList, len +1, "%s:%s:%s:%s", envDirList, afTestRootDir, bindingRootDir, CONTROL_CONFIG_PATH);
}
else {
- len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen + 1;
+ len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen + 2;
dirList = malloc(len + 1);
- snprintf(dirList, len + 1, "%s:%s", bindingRootDir, CONTROL_CONFIG_PATH);
+ snprintf(dirList, len + 1, "%s:%s:%s", bindingRootDir, afTestRootDir, CONTROL_CONFIG_PATH);
}
configPath = CtlConfigSearch(apiHandle, dirList, CONTROL_PREFIX);
@@ -219,5 +234,6 @@ int afbBindingEntry(afb_api_t apiHandle) {
return ERROR;
}
+ free(afTestRootDir);
return CtrlCreateApi(apiHandle, CtrlLoadConfigFile(apiHandle, configPath));
}