main.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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, "loadFileTye", "", "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. if len(loadFileType) > 0 {
  38. conf.PathConfig.LoadFileType = loadFileType
  39. } else {
  40. conf.PathConfig.LoadFileType = LoadFileType
  41. }
  42. if len(etcPath) > 0 {
  43. conf.PathConfig.Dirs["etc"] = etcPath
  44. }
  45. if len(dataPath) > 0 {
  46. conf.PathConfig.Dirs["data"] = dataPath
  47. }
  48. if len(logPath) > 0 {
  49. conf.PathConfig.Dirs["log"] = logPath
  50. }
  51. if len(pluginsPath) > 0 {
  52. conf.PathConfig.Dirs["plugins"] = pluginsPath
  53. }
  54. }
  55. func main() {
  56. server.StartUp(Version)
  57. }