feat(init): Start implementing system config
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
8688baccb2
commit
48b1739576
@ -36,8 +36,8 @@ func (a APIType) GetInitializeUserInput(params *models.UserInputParams) (*models
|
||||
params.GoModuleName = &goModulePath
|
||||
}
|
||||
|
||||
log.Info("Do you want to enable database integration ?")
|
||||
params.DB = helpers.YesOrNoInput()
|
||||
log.Info("Do you want to enable database models auto generation ?")
|
||||
params.DatabaseModels = helpers.YesOrNoInput()
|
||||
|
||||
return params, nil
|
||||
}
|
||||
|
22
helpers/config.go
Normal file
22
helpers/config.go
Normal file
@ -0,0 +1,22 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"git.home.m-and-m.ovh/mderasse/gouick/helpers/models"
|
||||
)
|
||||
|
||||
const configFile = ".gouick.yaml"
|
||||
|
||||
// ReadConfig will search the config file in the given path, read it and return a Config object
|
||||
func ReadConfig(path string) (*models.Config, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// WriteConfig will write the new or updated config
|
||||
func WriteConfig(path string, config *models.Config) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteConfigFromUserInputParams
|
||||
func WriteConfigFromUserInputParams(path string, userInput *models.UserInputParams) error {
|
||||
return nil
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
// Package helpers contains all basic function that might make development easier / avoid code duplication
|
||||
package helpers
|
||||
|
||||
const configFile = ".gouick.yaml"
|
19
helpers/models/config.go
Normal file
19
helpers/models/config.go
Normal file
@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
// Config structure represent the main configuration of the project.
|
||||
type Config struct {
|
||||
ProjectName string `yaml:"project_name"`
|
||||
ProjectDescription string `yaml:"project_description"`
|
||||
ProjectOwner string `yaml:"project_owner"`
|
||||
Features FeaturesConfig `yaml:"features"`
|
||||
}
|
||||
|
||||
// FeaturesConfig structure represent the configuration of all possible features.
|
||||
type FeaturesConfig struct {
|
||||
DatabaseModels DatabaseModelsConfig `yaml:"database_models"`
|
||||
}
|
||||
|
||||
// DatabaseModelsConfig structure represent the configuration of the Database Models feature.
|
||||
type DatabaseModelsConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
}
|
@ -2,7 +2,7 @@ package models
|
||||
|
||||
// UserInputParams is a struct containing all fields that can be useful for project generation.
|
||||
type UserInputParams struct {
|
||||
DB bool
|
||||
DatabaseModels bool
|
||||
GoModuleName *string
|
||||
ProjectDescription string
|
||||
ProjectDirectory string
|
Loading…
Reference in New Issue
Block a user