diff --git a/config/app.go b/config/app.go deleted file mode 100644 index 7ddc588..0000000 --- a/config/app.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2024 OrigAdmin. All rights reserved. - -// Package config is the config package for origen -package config - -type App struct { - Enable bool -} diff --git a/config/application.go b/config/application.go new file mode 100644 index 0000000..4968cb0 --- /dev/null +++ b/config/application.go @@ -0,0 +1,10 @@ +// Copyright (c) 2024 OrigAdmin. All rights reserved. + +// Package config is the config package for origen +package config + +type Application struct { + Type string // 例如: "web", "mobile", "desktop" + TemplatePath string + OutputPath string +} diff --git a/config/config.go b/config/config.go index e4f3e85..cce0098 100644 --- a/config/config.go +++ b/config/config.go @@ -12,23 +12,26 @@ import ( "github.com/origadmin/toolkits/codec" ) -const Application = `Origen` +const ( + Project = "origin" + PackageName = "application" +) // Config is the configuration of admin-cli. type Config struct { - Application string - PackageName string - Author string - WirePath string - SwaggerPath string - Description string - Version string - App App `json:"app" yaml:"app" toml:"app"` // app - Fontend Fontend `json:"fontend" yaml:"fontend" toml:"fontend"` // fontend - Backend Backend `json:"backend" yaml:"backend" toml:"backend"` // backend - Database Database `json:"database" yaml:"database" toml:"database"` // database - Extension Extension `json:"extension" yaml:"extension" toml:"extension"` // extension - Services map[string]Service `json:"services" yaml:"services" toml:"services"` // services + Project string `json:"project" default:"origin"` + PackageName string `json:"package_name" default:"application"` + Author string `json:"author" default:"Origen"` + WirePath string `json:"wire_path"` + SwaggerPath string `json:"swagger_path"` + Description string `json:"description"` + Application Application `json:"application" yaml:"application" toml:"application"` // application + Fontend Fontend `json:"fontend" yaml:"fontend" toml:"fontend"` // fontend + Backend Backend `json:"backend" yaml:"backend" toml:"backend"` // backend + Database Database `json:"database" yaml:"database" toml:"database"` // database + Extension Extension `json:"extension" yaml:"extension" toml:"extension"` // extension + Services map[string]Service `json:"services" yaml:"services" toml:"services"` // services + Version string `json:"version"` } // Save saves config to file diff --git a/config/database.go b/config/database.go index 6d02ad9..897739c 100644 --- a/config/database.go +++ b/config/database.go @@ -4,5 +4,11 @@ package config type Database struct { - Enable bool `json:"enable" yaml:"enable" toml:"enable"` + Enable bool `json:"enable" yaml:"enable" toml:"enable"` + Dialect string // 例如: "mysql", "postgresql", "sqlite" + Host string + Port int + Username string + Password string + Database string } diff --git a/config/fontend.go b/config/fontend.go index afa6a2a..9e2e62c 100644 --- a/config/fontend.go +++ b/config/fontend.go @@ -4,5 +4,7 @@ package config type Fontend struct { - Enable bool + Enable bool + TemplatePath string + OutputPath string }