qicosmos / feather

a modern, rapid,cross-platform web development framework developed in c++17

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

issue on example site in main.cpp

edvinator opened this issue · comments

in main.cpp
bool ret = config_manager::from_file(cfg, "./cfg/feather.cfg");

returns false. I have to use a absolute path to the file or ../cfg/feather.cfg then it succeeds

after that the "init" function throws:
terminate called after throwing an instance of 'std::invalid_argument'
what(): init failed
Aborted (core dumped)

when calling
dao_t<dbng>::init(cfg.db_conn_num, cfg.db_ip.data(), cfg.user_name.data(), cfg.pwd.data(),
cfg.db_name.data(), cfg.timeout);

what could fix this issue?
compiler g++ 7.3.0
operating system ubuntu

open the feather.cfg file, you will see some configurations, you should config the database items, for example:

"db_ip": "127.0.0.1",
"user_name": "feather",
"pwd": "12345",
"db_name": "feather",

you should fill the right database ip, user_name, pwd and database name.
It means you should make sure the database has already exist at first.

please check it

Hi i created a mysql db before calling init in main.cpp which compiles but it still throws 'std::invalid_argument'. I appreciate your help.

dbng mysql;
mysql.connect("127.0.0.1", "feather", "12345", "feather");

mysql.commit();

init(cfg);

cfg/feather.cfg:
{
"thread_num": 4,
"port": "8080",
"db_ip": "127.0.0.1",
"user_name": "feather",
"pwd": "12345",
"db_name": "feather",
"timeout": 2,
"db_conn_num": 4,
"drop_all_table": 0,
"log_path": "/tmp",
"log_name": "feather.log",
"roll_file_size": 2
}

make sure your database has already run, the error shows that feather can't connet to your databse