summaryrefslogtreecommitdiff
path: root/src/config.hpp
blob: afdf396b037c94f7373b82858746700f4dedfc30 (plain)
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
#pragma once

#include <optional>
#include <string>

#define GET_DATABASE_CONNECTION_URL(c)                                      \
  "dbname = " + c.database.name + " user = " + c.database.user +            \
      " password = " + c.database.password + " host = " + c.database.host + \
      " port = " + c.database.port

namespace bot {
  struct DatabaseConfiguration {
      std::string name;
      std::string user;
      std::string password;
      std::string host;
      std::string port;
  };

  struct Configuration {
      std::string bot_username;
      std::string bot_password;
      std::string bot_client_id;
      DatabaseConfiguration database;
  };

  std::optional<Configuration> parse_configuration_from_file(
      const std::string &file_path);
}