initial commit
This commit is contained in:
36
README.md
Normal file
36
README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# json-configure
|
||||
|
||||
## usage
|
||||
|
||||
```shell
|
||||
go get
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import "log"
|
||||
|
||||
type AppConfig struct {
|
||||
AppName string `json:"app_name"`
|
||||
AppVersion string `json:"app_version"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
configure := AppConfig{
|
||||
AppName: "aaaaa",
|
||||
}
|
||||
cc := ConfigConfigure{
|
||||
AppName: "json-configure",
|
||||
ContainerType: BesidesExe,
|
||||
ConfigureFile: "config.json",
|
||||
}
|
||||
cc.Check()
|
||||
cc.MakeupContainerPath()
|
||||
log.Println("Configure Container Path:", cc.ContainerPath)
|
||||
cc.EnsureContainer()
|
||||
configure = cc.EnsureConfigure(configure).(AppConfig)
|
||||
log.Println("AppName:", configure.AppName)
|
||||
log.Println("AppVersion:", configure.AppVersion)
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user