-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.cpp
More file actions
53 lines (44 loc) · 1.62 KB
/
Copy pathprogram.cpp
File metadata and controls
53 lines (44 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include "src/utils/debug.hpp"
#include "src/utils/config.hpp"
#include "src/utils/cache.hpp"
#include "src/services/database.hpp"
#include "src/services/auth.hpp"
#include "src/services/webserver.hpp"
#include "src/providers/lazy_auth.hpp"
#include "src/utils/http.hpp"
#include "src/proxmox/requests.hpp"
using namespace Utils::Cache;
using Utils::Debug;
using Utils::Config::Env_Struct;
using Services::Database;
using Proxmox::Requests;
int main(){
Debug::Log("Volum-Backend starting up...", "MAIN");
// First thing to do: Parse config
Debug::Log("Parsing env file", "MAIN");
// Parse config
Env_Struct& env = Env_Struct::getInstance();
// Connect to DB
Debug::Log("Connecting to DB", "MAIN");
auto& db = Database::getInstance();
// Test: retrieve status
auto& conn = db.getConnection();
auto stmt = conn->createStatement();
auto res = stmt->executeQuery("SELECT * FROM volum_status WHERE id = 1");
while(res->next()){
Debug::Log("Status: " + std::string(res->getString("status")) + " and Version: " + std::string(res->getString("version")), "MAIN");
}
// Change your auth provider here, if needed !
Providers::Auth::Lazy::LazyAuth auth_provider;
std::shared_ptr<Providers::Auth::Lazy::LazyAuth> provider = std::make_shared<Providers::Auth::Lazy::LazyAuth>(auth_provider);
env.set_auth_handler(provider);
// // Test proxmox conn
// Requests requests;
// requests.list_lxcs();
Debug::Log("Launching web server ...", "MAIN");
Services::WebServer ws;
ws.register_routes();
ws.run_server(env.webserver_port);
return 0;
}