mirror of https://git.48k.eu/ogserver
parent
d7a871b529
commit
3cea4bb763
|
@ -26,6 +26,6 @@ struct og_server_cfg {
|
||||||
int parse_json_config(const char *filename, struct og_server_cfg *cfg);
|
int parse_json_config(const char *filename, struct og_server_cfg *cfg);
|
||||||
void from_json_to_legacy(struct og_server_cfg *cfg);
|
void from_json_to_legacy(struct og_server_cfg *cfg);
|
||||||
|
|
||||||
extern struct og_server_cfg cfg;
|
extern struct og_server_cfg ogconfig;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,7 @@ static struct option og_server_opts[] = {
|
||||||
#define OG_SERVER_CFG_JSON "/opt/opengnsys/cfg/ogserver.json"
|
#define OG_SERVER_CFG_JSON "/opt/opengnsys/cfg/ogserver.json"
|
||||||
#define OG_SERVER_REPO_PATH "/opt/opengnsys/images"
|
#define OG_SERVER_REPO_PATH "/opt/opengnsys/images"
|
||||||
|
|
||||||
struct og_server_cfg cfg = {
|
struct og_server_cfg ogconfig = {
|
||||||
.repo = {
|
.repo = {
|
||||||
.dir = OG_SERVER_REPO_PATH,
|
.dir = OG_SERVER_REPO_PATH,
|
||||||
},
|
},
|
||||||
|
@ -66,12 +66,12 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse_json_config(config_file, &cfg) < 0)
|
if (parse_json_config(config_file, &ogconfig) < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
from_json_to_legacy(&cfg);
|
from_json_to_legacy(&ogconfig);
|
||||||
|
|
||||||
socket_rest = og_socket_server_init(cfg.rest.port);
|
socket_rest = og_socket_server_init(ogconfig.rest.port);
|
||||||
if (socket_rest < 0) {
|
if (socket_rest < 0) {
|
||||||
syslog(LOG_ERR, "Cannot open REST API server socket\n");
|
syslog(LOG_ERR, "Cannot open REST API server socket\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -1548,7 +1548,7 @@ struct og_image {
|
||||||
static int og_get_image_stats(const char *name,
|
static int og_get_image_stats(const char *name,
|
||||||
struct stat *image_stats)
|
struct stat *image_stats)
|
||||||
{
|
{
|
||||||
const char *dir = cfg.repo.dir;
|
const char *dir = ogconfig.repo.dir;
|
||||||
char filename[PATH_MAX + 1];
|
char filename[PATH_MAX + 1];
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "%s/%s", dir, name);
|
snprintf(filename, sizeof(filename), "%s/%s", dir, name);
|
||||||
|
@ -1561,7 +1561,7 @@ static int og_get_image_stats(const char *name,
|
||||||
|
|
||||||
static json_t *og_json_disk_alloc()
|
static json_t *og_json_disk_alloc()
|
||||||
{
|
{
|
||||||
const char *dir = cfg.repo.dir;
|
const char *dir = ogconfig.repo.dir;
|
||||||
struct statvfs buffer;
|
struct statvfs buffer;
|
||||||
json_t *disk_json;
|
json_t *disk_json;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
Loading…
Reference in New Issue