mirror of https://github.com/oxen-io/lokinet
add -c for client auto-config, -f for overwrite
This commit is contained in:
parent
fb9b60bd16
commit
c11e61a51d
|
@ -6,6 +6,7 @@
|
|||
#include <iostream>
|
||||
#include <libgen.h>
|
||||
#include "fs.hpp"
|
||||
#include "config.hpp" // for ensure_config
|
||||
|
||||
#ifdef _WIN32
|
||||
#define wmin(x, y) (((x) < (y)) ? (x) : (y))
|
||||
|
@ -24,7 +25,7 @@ handle_signal(int sig)
|
|||
int
|
||||
printHelp(const char *argv0, int code = 1)
|
||||
{
|
||||
std::cout << "usage: " << argv0 << " [-h] [-g] config.ini" << std::endl;
|
||||
std::cout << "usage: " << argv0 << " [-h] [-g|-c] config.ini" << std::endl;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -40,7 +41,9 @@ main(int argc, char *argv[])
|
|||
|
||||
int opt = 0;
|
||||
bool genconfigOnly = false;
|
||||
while((opt = getopt(argc, argv, "hg")) != -1)
|
||||
bool asRouter = true;
|
||||
bool overWrite = false;
|
||||
while((opt = getopt(argc, argv, "hgcf")) != -1)
|
||||
{
|
||||
switch(opt)
|
||||
{
|
||||
|
@ -49,6 +52,13 @@ main(int argc, char *argv[])
|
|||
case 'g':
|
||||
genconfigOnly = true;
|
||||
break;
|
||||
case 'c':
|
||||
genconfigOnly = true;
|
||||
asRouter = false;
|
||||
break;
|
||||
case 'f':
|
||||
overWrite = true;
|
||||
break;
|
||||
default:
|
||||
return printHelp(argv[0]);
|
||||
}
|
||||
|
@ -80,7 +90,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
if(!llarp_ensure_config(fname.string().c_str(), basedir.string().c_str(),
|
||||
genconfigOnly))
|
||||
overWrite, asRouter))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +117,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if(!llarp_ensure_config(fpath.string().c_str(), basepath.string().c_str(),
|
||||
genconfigOnly))
|
||||
overWrite, asRouter))
|
||||
return 1;
|
||||
conffname = fpath.string();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue