-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ecdysis to Conduit CLI #1983
base: main
Are you sure you want to change the base?
Conversation
cmd/conduit/root/root.go
Outdated
// Root flags ------------------------------------------------------------- | ||
|
||
// Database configuration | ||
DBType string `long:"db.type" usage:"database type; accepts badger,postgres,inmemory,sqlite"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about moving these tags to Conduit's Config
struct? It looks like that would make the Config
struct the single source of truth. It should then be possible to build the flags by just traversing the Config
fields. Also, when building the config.yaml file in the InitCommand
, we would have everything in the config struct (name, usage, and values).
Btw, even if we find that this is possible and useful, IMO it can be done in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for i := 0; i < v.NumField(); i++ { | ||
field := t.Field(i) | ||
fieldValue := v.Field(i) | ||
|
||
if fieldValue.Kind() == reflect.Struct { | ||
embedStructYAML(fieldValue, field, cfgYAML) | ||
} else { | ||
value := fmt.Sprintf("%v", fieldValue.Interface()) | ||
usage := field.Tag.Get("usage") | ||
longName := field.Tag.Get("long") | ||
|
||
if longName != "" { | ||
cfgYAML.Insert(longName, value, usage) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop is actually the embedStructYAML()
function or maybe I'm missing a difference?
} | ||
|
||
// provide a simplified version | ||
if c.flags.Source == defaultSource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking, what if someone would like to configure a generator
source himself? Maybe generator the demo source, only if a source was not provided?
|
||
is.True(foundFlag != nil) | ||
|
||
if foundFlag != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nitpick: we don't need this check, because the above line with is.True() will abort the test if it's not true.
Description
Fixes #1981
init
and utilize its tagspipelines.exit-on-error
(announced here)Quick checks