certs.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef PATH_HEAER
  2. #define PATH_HEAER
  3. #include "util/tc_config.h"
  4. using namespace tars;
  5. static const string CONFIGPATH(CMAKE_SOURCE_DIR);
  6. inline TC_Config CONFIG()
  7. {
  8. string confFile = TC_Common::replace(TC_File::load2str(CONFIGPATH + "/server/hello.conf"), "PROJECT_PATH", CONFIGPATH);
  9. TC_Config conf;
  10. conf.parseString(confFile);
  11. return conf;
  12. }
  13. inline TC_Config CLIENT_CONFIG()
  14. {
  15. string confFile = TC_Common::replace(TC_File::load2str(CONFIGPATH + "/server/client.conf"), "PROJECT_PATH", CONFIGPATH);
  16. TC_Config conf;
  17. conf.parseString(confFile);
  18. return conf;
  19. }
  20. inline TC_Config FRAMEWORK_CONFIG()
  21. {
  22. TC_Config conf;
  23. conf.parseFile(CONFIGPATH + "/server/framework.conf");
  24. return conf;
  25. }
  26. inline TC_Config RPC1_CONFIG()
  27. {
  28. TC_Config conf;
  29. conf.parseFile(CONFIGPATH + "/server/rpc1.conf");
  30. return conf;
  31. }
  32. inline TC_Config RPC2_CONFIG()
  33. {
  34. TC_Config conf;
  35. conf.parseFile(CONFIGPATH + "/server/rpc2.conf");
  36. return conf;
  37. }
  38. inline TC_Config RPC3_CONFIG()
  39. {
  40. TC_Config conf;
  41. conf.parseFile(CONFIGPATH + "/server/rpc3.conf");
  42. return conf;
  43. }
  44. inline TC_Config WIN_CONFIG()
  45. {
  46. TC_Config conf;
  47. conf.parseFile(CONFIGPATH + "/server/windows.conf");
  48. return conf;
  49. }
  50. #define CA (CONFIGPATH + "/certs/ca.crt")
  51. #define SERVER_CERT (CONFIGPATH + "/certs/server.crt")
  52. #define CLIENT_CERT (CONFIGPATH + "/certs/client.crt")
  53. #define SERVER_KEY (CONFIGPATH + "/certs/server.key")
  54. #define CLIENT_KEY (CONFIGPATH + "/certs/client.key")
  55. #endif