diff options
| -rw-r--r-- | data.c | 15 |
1 files changed, 11 insertions, 4 deletions
| @@ -30,7 +30,7 @@ int srv_open(char *basedir) | |||
| 30 | cfg_file = xs_fmt("%s/server.json", basedir); | 30 | cfg_file = xs_fmt("%s/server.json", basedir); |
| 31 | 31 | ||
| 32 | if ((f = fopen(cfg_file, "r")) == NULL) | 32 | if ((f = fopen(cfg_file, "r")) == NULL) |
| 33 | error = xs_fmt("error opening '%s'", cfg_file); | 33 | error = xs_fmt("ERROR: cannot opening '%s'", cfg_file); |
| 34 | else { | 34 | else { |
| 35 | xs *cfg_data; | 35 | xs *cfg_data; |
| 36 | 36 | ||
| @@ -41,18 +41,21 @@ int srv_open(char *basedir) | |||
| 41 | srv_config = xs_json_loads(cfg_data); | 41 | srv_config = xs_json_loads(cfg_data); |
| 42 | 42 | ||
| 43 | if (srv_config == NULL) | 43 | if (srv_config == NULL) |
| 44 | error = xs_fmt("cannot parse '%s'", cfg_file); | 44 | error = xs_fmt("ERROR: cannot parse '%s'", cfg_file); |
| 45 | else { | 45 | else { |
| 46 | char *host; | 46 | char *host; |
| 47 | char *prefix; | 47 | char *prefix; |
| 48 | char *dbglvl; | 48 | char *dbglvl; |
| 49 | char *layout; | ||
| 50 | double f = 0.0; | ||
| 49 | 51 | ||
| 50 | host = xs_dict_get(srv_config, "host"); | 52 | host = xs_dict_get(srv_config, "host"); |
| 51 | prefix = xs_dict_get(srv_config, "prefix"); | 53 | prefix = xs_dict_get(srv_config, "prefix"); |
| 52 | dbglvl = xs_dict_get(srv_config, "dbglevel"); | 54 | dbglvl = xs_dict_get(srv_config, "dbglevel"); |
| 55 | layout = xs_dict_get(srv_config, "layout"); | ||
| 53 | 56 | ||
| 54 | if (host == NULL || prefix == NULL) | 57 | if (host == NULL || prefix == NULL) |
| 55 | error = xs_str_new("cannot get server data"); | 58 | error = xs_str_new("ERROR: cannot get server data"); |
| 56 | else { | 59 | else { |
| 57 | srv_baseurl = xs_fmt("https://%s%s", host, prefix); | 60 | srv_baseurl = xs_fmt("https://%s%s", host, prefix); |
| 58 | 61 | ||
| @@ -63,8 +66,12 @@ int srv_open(char *basedir) | |||
| 63 | error = xs_fmt("DEBUG level set to %d from environment", dbglevel); | 66 | error = xs_fmt("DEBUG level set to %d from environment", dbglevel); |
| 64 | } | 67 | } |
| 65 | 68 | ||
| 66 | ret = 1; | 69 | if (!layout || (f = xs_number_get(layout)) != 2.0) |
| 70 | error = xs_fmt("ERROR: unsupported old disk layout %f\n", f); | ||
| 71 | else | ||
| 72 | ret = 1; | ||
| 67 | } | 73 | } |
| 74 | |||
| 68 | } | 75 | } |
| 69 | } | 76 | } |
| 70 | 77 | ||