main: Pass absolute path of config file
As sandboxing code chroots and chdirs away,
This commit is contained in:
		
							
								
								
									
										14
									
								
								qswiki.cpp
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								qswiki.cpp
									
									
									
									
									
								
							@@ -77,21 +77,21 @@ int main(int argc, char **argv)
 | 
			
		||||
		Logger::error() << "Sandbox is not supported, exiting";
 | 
			
		||||
		exit(EXIT_FAILURE);
 | 
			
		||||
	}
 | 
			
		||||
	if(argc < 2)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "no path to config file provided" << std::endl;
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	std::string configpath = std::filesystem::absolute(argv[1]).string();
 | 
			
		||||
	if(!sandbox->enableForInit())
 | 
			
		||||
	{
 | 
			
		||||
		Logger::error() << "Sandboxing for init mode could not be activated.";
 | 
			
		||||
		exit(EXIT_FAILURE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(argc < 2)
 | 
			
		||||
	{
 | 
			
		||||
		std::cerr << "no path to config file provided" << std::endl;
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	try
 | 
			
		||||
	{
 | 
			
		||||
		ConfigReader configreader(argv[1]);
 | 
			
		||||
		ConfigReader configreader(configpath);
 | 
			
		||||
		Config config = configreader.readConfig();
 | 
			
		||||
 | 
			
		||||
		// TODO: config.connectiontring only works as long as we only support sqlite of course
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user