Updates how config options are set on command line

This commit is contained in:
Jonathan Hodgson 2021-12-28 10:00:41 +00:00
parent 8bed39700e
commit f392af92c3
5 changed files with 56 additions and 22 deletions

View file

@ -63,3 +63,21 @@ char* getDefaultUserConfigLoc(){
return strdup(configFile);
}
void setConfig(Config *config, char option[], char value[]){
if ( strcmp( option, "database" ) == 0 ){
config->database = value;
} else if ( strcmp( option, "localConfig" ) == 0 ){
config->localConfig = value;
} else if ( strcmp( option, "userConfig" ) == 0 ){
config->userConfig = value;
} else if ( strcmp( option, "port" ) == 0 ){
config->port = atoi(value);
}
}
void printConfig(Config *config){
printf("Database: %s\n", config->database);
printf("localConfig: %s\n", config->localConfig);
printf("userConfig: %s\n", config->userConfig);
printf("port: %i\n", config->port);
}