diff options
author | 2018-03-21 14:55:24 +0100 | |
---|---|---|
committer | 2018-06-13 17:13:29 +0200 | |
commit | 8dc14014ad83952343d2473140103650555d5ea2 (patch) | |
tree | 3a520d9cfaf1b4175d1f1100506a9119a21576e9 /src/afs-config.c | |
parent | 3b52373e31ed3bdfe6544f2a5e81d68b111d1767 (diff) |
afs-supervisor: Fix typo
Change-Id: Icc3c15f577f04117cdfaf2bcbcc4d15a99d02138
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afs-config.c')
-rw-r--r-- | src/afs-config.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/afs-config.c b/src/afs-config.c index 3cb851be..eee4ccc0 100644 --- a/src/afs-config.c +++ b/src/afs-config.c @@ -28,9 +28,18 @@ #include "afs-config.h" #if !defined(AFB_VERSION) -#error "you should define AFB_VERSION" +# error "you should define AFB_VERSION" #endif +#if !defined(AFS_SUPERVISOR_TOKEN) +# define AFS_SUPERVISOR_TOKEN "" +#endif +#if !defined(AFS_SUPERVISOR_PORT) +# define AFS_SUPERVISOR_PORT 1619 +#endif +#define _STRINGIFY_(x) #x +#define STRINGIFY(x) _STRINGIFY_(x) + // default #define DEFLT_CNTX_TIMEOUT 32000000 // default Client Connection // Timeout: few more than one year @@ -88,7 +97,7 @@ static AFB_options cliOptions[] = { {SET_NAME, 1, "name", "Set the visible name"}, - {SET_TCP_PORT, 1, "port", "HTTP listening TCP port [default 1234]"}, + {SET_TCP_PORT, 1, "port", "HTTP listening TCP port [default " STRINGIFY(AFS_SUPERVISOR_PORT) "]"}, {SET_ROOT_HTTP, 1, "roothttp", "HTTP Root Directory [default no root http (files not served but apis still available)]"}, {SET_ROOT_BASE, 1, "rootbase", "Angular Base Root URL [default /opa]"}, {SET_ROOT_API, 1, "rootapi", "HTML Root API URL [default /api]"}, @@ -102,7 +111,7 @@ static AFB_options cliOptions[] = { {SET_ROOT_DIR, 1, "rootdir", "Root Directory of the application [default: workdir]"}, {SET_SESSION_DIR, 1, "sessiondir", "OBSOLETE (was: Sessions file path)"}, - {SET_AUTH_TOKEN, 1, "token", "Initial Secret [default=random, use --token="" to allow any token]"}, + {SET_AUTH_TOKEN, 1, "token", "Initial Secret [default=" AFS_SUPERVISOR_TOKEN ", use --token="" to allow any token]"}, {DISPLAY_VERSION, 0, "version", "Display version and copyright"}, {DISPLAY_HELP, 0, "help", "Display this help"}, @@ -335,7 +344,7 @@ static void fulfill_config(struct afs_config *config) { // default HTTP port if (config->httpdPort == 0) - config->httpdPort = 1234; + config->httpdPort = AFS_SUPERVISOR_PORT; // default binding API timeout if (config->apiTimeout == 0) @@ -369,6 +378,9 @@ static void fulfill_config(struct afs_config *config) if (config->rootapi == NULL) config->rootapi = "/api"; + + if (config->token == NULL) + config->token = AFS_SUPERVISOR_TOKEN; } void afs_config_dump(struct afs_config *config) |