@@ -12,14 +12,12 @@ import (
1212)
1313
1414type Config struct {
15- Log * MokApiLog `json:"log" yaml:"log"`
16- ConfigFile string `json:"-" yaml:"-"`
15+ Log MokApiLog `json:"log" yaml:"log"`
16+ ConfigFile string `json:"-" yaml:"-" flag:"-" `
1717 Providers Providers `json:"providers" yaml:"providers"`
1818 Api Api `json:"api" yaml:"api"`
19- RootCaCert tls.FileOrContent `json:"rootCaCert" yaml:"rootCaCert"`
20- RootCaKey tls.FileOrContent `json:"rootCaKey" yaml:"rootCaKey"`
21- Services Services `json:"-" yaml:"-"`
22- Js JsConfig `json:"js" yaml:"js"`
19+ RootCaCert tls.FileOrContent `json:"rootCaCert" yaml:"rootCaCert" name:"root-ca-cert"`
20+ RootCaKey tls.FileOrContent `json:"rootCaKey" yaml:"rootCaKey" name:"root-ca-cert"`
2321 Configs Configs `json:"configs" yaml:"configs" explode:"config"`
2422 Help bool `json:"-" yaml:"-" aliases:"h"`
2523 GenerateSkeleton interface {} `json:"-" yaml:"-" flag:"generate-cli-skeleton"`
@@ -33,7 +31,7 @@ type Config struct {
3331
3432func NewConfig () * Config {
3533 cfg := & Config {}
36- cfg .Log = & MokApiLog {Level : "info" , Format : "text" }
34+ cfg .Log = MokApiLog {Level : "info" , Format : "text" }
3735
3836 cfg .Api .Port = "8080"
3937 cfg .Api .Dashboard = true
@@ -67,37 +65,31 @@ type Api struct {
6765
6866type Search struct {
6967 Enabled bool
70- Types []string
71- }
72-
73- type NgramAnalyzer struct {
74- Min int
75- Max int
7668}
7769
7870type FileProvider struct {
7971 Filenames []string `explode:"filename"`
8072 Directories []string `explode:"directory"`
81- SkipPrefix []string `flag:"skip-prefix"`
73+ SkipPrefix []string `yaml:"skipPrefix" json:"skipPrefix" flag:"skip-prefix"`
8274 Include []string
8375}
8476
8577type GitProvider struct {
8678 Urls []string `explode:"url"`
87- PullInterval string `yaml:"pullInterval" name:"pull-interval"`
88- TempDir string `yaml:"tempDir" name:"temp-dir"`
79+ PullInterval string `yaml:"pullInterval" json:"pullInterval" name:"pull-interval"`
80+ TempDir string `yaml:"tempDir" json:"tempDir" name:"temp-dir"`
8981
9082 Repositories []GitRepo `explode:"repository"`
9183}
9284
9385type GitRepo struct {
9486 Url string
9587 // Specifies an allow list of files to include in mokapi
96- Files []string
88+ Files []string `explode:"file"`
9789 // Specifies an array of filenames pr pattern to include in mokapi
9890 Include []string
9991 Auth * GitAuth
100- PullInterval string `yaml:"pullInterval"`
92+ PullInterval string `yaml:"pullInterval" name:"pull-interval" `
10193}
10294
10395type GitAuth struct {
@@ -112,15 +104,15 @@ type GitHubAuth struct {
112104
113105type HttpProvider struct {
114106 Urls []string `explode:"url"`
115- PollInterval string `yaml:"pollInterval" flag :"poll-interval"`
116- PollTimeout string `yaml:"pollTimeout" flag :"poll-timeout"`
107+ PollInterval string `yaml:"pollInterval" name :"poll-interval"`
108+ PollTimeout string `yaml:"pollTimeout" name :"poll-timeout"`
117109 Proxy string
118110 TlsSkipVerify bool `yaml:"tlsSkipVerify" flag:"tls-skip-verify"`
119111 Ca tls.FileOrContent `yaml:"ca"`
120112}
121113
122114type NpmProvider struct {
123- GlobalFolders []string `yaml:"globalFolders" flag :"global-folders"`
115+ GlobalFolders []string `yaml:"globalFolders" name:"global-folders" explode :"global-folders"`
124116 Packages []NpmPackage `explode:"package"`
125117}
126118
@@ -132,36 +124,6 @@ type NpmPackage struct {
132124 Include []string
133125}
134126
135- type Services map [string ]* Service
136-
137- func (s Services ) GetByName (name string ) * Service {
138- key := strings .ReplaceAll (name , " " , "-" )
139- key = strings .ToLower (key )
140- return s [key ]
141- }
142-
143- type Service struct {
144- Config ServiceConfig
145- Http * HttpService
146- }
147-
148- type ServiceConfig struct {
149- File string
150- Url string
151- }
152-
153- type HttpService struct {
154- Servers []HttpServer
155- }
156-
157- type HttpServer struct {
158- Url string
159- }
160-
161- type JsConfig struct {
162- GlobalFolders []string
163- }
164-
165127type Event struct {
166128 Store map [string ]Store
167129}
@@ -182,7 +144,7 @@ type Certificate struct {
182144}
183145
184146type DataGen struct {
185- OptionalProperties string `yaml:"optionalProperties" json:"optionalProperties"`
147+ OptionalProperties string `yaml:"optionalProperties" json:"optionalProperties" name:"optional-properties" `
186148}
187149
188150func (c * Configs ) UnmarshalJSON (b []byte ) error {
0 commit comments