qicosmos / feather

a modern, rapid,cross-platform web development framework developed in c++17
MIT License
387 stars 96 forks source link

issue on example site in main.cpp #21

Open edvinator opened 5 years ago

edvinator commented 5 years ago

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

qicosmos commented 5 years ago

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

edvinator commented 5 years ago

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 }

qicosmos commented 5 years ago

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