main.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2021-2023 EMQ Technologies Co., Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package main
  15. import (
  16. "flag"
  17. "github.com/lf-edge/ekuiper/internal/conf"
  18. "github.com/lf-edge/ekuiper/internal/server"
  19. )
  20. var (
  21. Version = "unknown"
  22. LoadFileType = "relative"
  23. )
  24. var (
  25. loadFileType string
  26. etcPath string
  27. dataPath string
  28. logPath string
  29. pluginsPath string
  30. )
  31. func init() {
  32. flag.StringVar(&loadFileType, "loadFileType", "", "loadFileType indicates the how to load path")
  33. flag.StringVar(&etcPath, "etc", "", "etc indicates the path of etc dir")
  34. flag.StringVar(&dataPath, "data", "", "data indicates the path of data dir")
  35. flag.StringVar(&logPath, "log", "", "log indicates the path of log dir")
  36. flag.StringVar(&pluginsPath, "plugins", "", "plugins indicates the path of plugins dir")
  37. flag.Parse()
  38. if len(loadFileType) > 0 {
  39. conf.PathConfig.LoadFileType = loadFileType
  40. } else {
  41. conf.PathConfig.LoadFileType = LoadFileType
  42. }
  43. if len(etcPath) > 0 {
  44. conf.PathConfig.Dirs["etc"] = etcPath
  45. }
  46. if len(dataPath) > 0 {
  47. conf.PathConfig.Dirs["data"] = dataPath
  48. }
  49. if len(logPath) > 0 {
  50. conf.PathConfig.Dirs["log"] = logPath
  51. }
  52. if len(pluginsPath) > 0 {
  53. conf.PathConfig.Dirs["plugins"] = pluginsPath
  54. }
  55. }
  56. func main() {
  57. server.StartUp(Version)
  58. }