]> git.uzoombox.com Git - uzsdk-v0.3.1.git/commitdiff
feat(all): add types.Configuration. v0.2.0
authorbruce <bruce@nanzoom.com>
Mon, 12 Jun 2023 02:29:22 +0000 (10:29 +0800)
committerbruce <bruce@nanzoom.com>
Mon, 12 Jun 2023 02:29:22 +0000 (10:29 +0800)
components/logger/logger.go [moved from logger/logger.go with 100% similarity]
service/translations/en_US.go [moved from translations/en_US.go with 100% similarity]
service/translations/translation.go [moved from translations/translation.go with 100% similarity]
service/translations/zh_CN.go [moved from translations/zh_CN.go with 100% similarity]
service/types/application.go [moved from application.go with 94% similarity]
service/types/configuration.go [new file with mode: 0644]
uzsdk.go
version.go

similarity index 100%
rename from logger/logger.go
rename to components/logger/logger.go
similarity index 94%
rename from application.go
rename to service/types/application.go
index 5c3dd03e6555de4e6e1057c4fe1da5a6ce5dac8b..f282258dc6b2ad2780a532927ce10ef89f24e13b 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright 2023 nanzoom.com. All Rights Reserved.
 
-package uzsdk
+package types
 
 // Application defines structure of application's information.
 type Application struct {
diff --git a/service/types/configuration.go b/service/types/configuration.go
new file mode 100644 (file)
index 0000000..a7f39f9
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2010-2022 nanzoom.com. All Rights Reserved.
+
+package types
+
+// Configuration defines application's configuration.
+type Configuration struct {
+       Service struct {
+               IP             string   // server listen address:ip, default: 0.0.0.0
+               Port           int64    // server listen address:port, default: 9000
+               ServerName     string   // local address served by this server, default: http://[IP]:[Port], exp: http://127.0.0.1:9000
+               SystemName     string   // smartsystem address served by httpd, default: http://[IP], exp: http://192.168.0.6
+               PublicName     string   // smartcloud address served by httpd, default: [ServerName], exp: http://192.168.0.6:8080
+               ServicePath    string   // urlpath for this service, default: /wservice
+               DataDirectory  string   // server data directory, default: /data/cloud
+               TrustedProxies []string // a list of proxies trusted, default: ["127.0.0.1"]
+       }
+}
index 10f9edf3cf2ad7befd290bde1084064282b014b0..fe6e0eda860465172902336a13026bbee0c649dc 100644 (file)
--- a/uzsdk.go
+++ b/uzsdk.go
@@ -3,8 +3,9 @@
 package uzsdk
 
 import (
-       "git.uzoombox.com/git/uzsdk/logger"
-       "git.uzoombox.com/git/uzsdk/translations"
+       "git.uzoombox.com/git/uzsdk/components/logger"
+       "git.uzoombox.com/git/uzsdk/service/translations"
+       "git.uzoombox.com/git/uzsdk/service/types"
        "github.com/gin-gonic/gin"
        "github.com/jmoiron/sqlx"
 )
@@ -111,7 +112,8 @@ type ResResultList struct {
 // Respcode returns a structure of Respnode that message has been translated using language if options.language is set,
 // else directly returns Respcode(code, ct.AdLanguage).
 // options will be [language]:
-//   language *string: name of language.
+//
+//     language *string: name of language.
 func Respcode(code string, options ...interface{}) Respnode {
        var language *string = nil
        for _, option := range options {
@@ -129,8 +131,9 @@ func Respcode(code string, options ...interface{}) Respnode {
 
 // Instance is the framework's instance, used for server & plugin both.
 type Instance struct {
-       Db          *sqlx.DB       // the first database connection created by main routine.
-       Logger      *logger.Logger // logger created by main routine.
-       Router      *gin.Engine    // default webservice engine created by main routine.
-       Maintenance bool           // when maintenance mode is true, only serve api /config.
+       Conf        *types.Configuration // configuration of this application.
+       Db          *sqlx.DB             // the first database connection created by main routine.
+       Logger      *logger.Logger       // logger created by main routine.
+       Router      *gin.Engine          // default webservice engine created by main routine.
+       Maintenance bool                 // when maintenance mode is true, only serve api /config.
 }
index 58a559bd24f61a353c1bed6e779aafaa65141e4f..42b77fda1129e02ee542e895ade73a32ffbc9d06 100644 (file)
@@ -1,4 +1,67 @@
 // Copyright 2023 nanzoom.com. All Rights Reserved.
+/* ## Package versions
+go 1.20
+
+require (
+    git.uzoombox.com/git/uzsdk v0.1.0
+    github.com/cavaliergopher/grab/v3 v3.0.1
+    github.com/chromedp/cdproto v0.0.0-20230611221135-4cd95c996604
+    github.com/chromedp/chromedp v0.9.1
+    github.com/cstockton/go-conv v1.0.0
+    github.com/fatih/structs v1.1.0
+    github.com/gin-contrib/gzip v0.0.6
+    github.com/gin-gonic/gin v1.9.1
+    github.com/huandu/go-sqlbuilder v1.21.0
+    github.com/jmoiron/sqlx v1.3.5
+    github.com/json-iterator/go v1.1.12
+    github.com/lib/pq v1.10.9
+    github.com/mafredri/cdp v0.34.1
+    github.com/pdfcpu/pdfcpu v0.4.1
+    github.com/spaolacci/murmur3 v1.1.0
+    github.com/wechatpay-apiv3/wechatpay-go v0.2.16
+    golang.org/x/sys v0.8.0
+)
+
+require (
+    github.com/bytedance/sonic v1.9.1 // indirect
+    github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
+    github.com/chromedp/sysutil v1.0.0 // indirect
+    github.com/gabriel-vasile/mimetype v1.4.2 // indirect
+    github.com/gin-contrib/sse v0.1.0 // indirect
+    github.com/go-playground/locales v0.14.1 // indirect
+    github.com/go-playground/universal-translator v0.18.1 // indirect
+    github.com/go-playground/validator/v10 v10.14.0 // indirect
+    github.com/gobwas/httphead v0.1.0 // indirect
+    github.com/gobwas/pool v0.2.1 // indirect
+    github.com/gobwas/ws v1.1.0 // indirect
+    github.com/goccy/go-json v0.10.2 // indirect
+    github.com/gorilla/websocket v1.4.2 // indirect
+    github.com/hhrutter/lzw v1.0.0 // indirect
+    github.com/hhrutter/tiff v1.0.0 // indirect
+    github.com/huandu/xstrings v1.3.2 // indirect
+    github.com/josharian/intern v1.0.0 // indirect
+    github.com/klauspost/cpuid/v2 v2.2.4 // indirect
+    github.com/leodido/go-urn v1.2.4 // indirect
+    github.com/mailru/easyjson v0.7.7 // indirect
+    github.com/mattn/go-isatty v0.0.19 // indirect
+    github.com/mattn/go-runewidth v0.0.14 // indirect
+    github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+    github.com/modern-go/reflect2 v1.0.2 // indirect
+    github.com/pelletier/go-toml/v2 v2.0.8 // indirect
+    github.com/pkg/errors v0.9.1 // indirect
+    github.com/rivo/uniseg v0.4.4 // indirect
+    github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
+    github.com/ugorji/go/codec v1.2.11 // indirect
+    golang.org/x/arch v0.3.0 // indirect
+    golang.org/x/crypto v0.9.0 // indirect
+    golang.org/x/image v0.5.0 // indirect
+    golang.org/x/net v0.10.0 // indirect
+    golang.org/x/text v0.9.0 // indirect
+    google.golang.org/protobuf v1.30.0 // indirect
+    gopkg.in/yaml.v2 v2.4.0 // indirect
+    gopkg.in/yaml.v3 v3.0.1 // indirect
+)
+*/
 
 package uzsdk