mirror of
https://github.com/cubixle/tuugen.git
synced 2026-04-30 11:38:44 +01:00
work on generating main.go and use config not hardcoded vals
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package tuugen
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
@@ -9,9 +11,14 @@ type Config struct {
|
||||
ServiceName string `yaml:"service_name"`
|
||||
ImportPath string `yaml:"import_path"`
|
||||
ProtoFile string `yaml:"proto_file"`
|
||||
GRPCFile string `yaml:"grpc_file"`
|
||||
DataModels []DataModel `yaml:"data_models"`
|
||||
}
|
||||
|
||||
func (c Config) GRPCPath() string {
|
||||
return filepath.Dir(c.GRPCFile)
|
||||
}
|
||||
|
||||
func YamlToConfig(b []byte) (Config, error) {
|
||||
cfg := Config{}
|
||||
err := yaml.Unmarshal(b, &cfg)
|
||||
|
||||
Reference in New Issue
Block a user