mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-20 19:29:54 +00:00
Merge branch 'main' into feat/cloud-load-balance
This commit is contained in:
commit
969fba8a57
1
.github/workflows/push_image.yml
vendored
1
.github/workflows/push_image.yml
vendored
@ -56,3 +56,4 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
|
||||||
|
3
Makefile
3
Makefile
@ -35,3 +35,6 @@ help:
|
|||||||
@echo " make help - 显示此帮助信息"
|
@echo " make help - 显示此帮助信息"
|
||||||
|
|
||||||
.PHONY: all build clean help
|
.PHONY: all build clean help
|
||||||
|
|
||||||
|
local.run:
|
||||||
|
go mod vendor&& npm --prefix ./ui install && npm --prefix ./ui run build && go run main.go serve --http 127.0.0.1:8090
|
||||||
|
@ -55,8 +55,7 @@ mkdir -p ~/.certimate && cd ~/.certimate && curl -O https://raw.githubuserconten
|
|||||||
```bash
|
```bash
|
||||||
git clone EMAIL:usual2970/certimate.git
|
git clone EMAIL:usual2970/certimate.git
|
||||||
cd certimate
|
cd certimate
|
||||||
go mod vendor
|
make local.run
|
||||||
go run main.go serve
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 二、使用
|
## 二、使用
|
||||||
|
@ -54,8 +54,7 @@ mkdir -p ~/.certimate && cd ~/.certimate && curl -O https://raw.githubuserconten
|
|||||||
```bash
|
```bash
|
||||||
git clone EMAIL:usual2970/certimate.git
|
git clone EMAIL:usual2970/certimate.git
|
||||||
cd certimate
|
cd certimate
|
||||||
go mod vendor
|
make local.run
|
||||||
go run main.go serve
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -76,7 +76,8 @@ func (d *QiniuCDNDeployer) Deploy(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *QiniuCDNDeployer) enableHttps(certId string) error {
|
func (d *QiniuCDNDeployer) enableHttps(certId string) error {
|
||||||
path := fmt.Sprintf("/domain/%s/sslize", getDeployString(d.option.DeployConfig, "domain"))
|
domain := d.option.DeployConfig.GetDomain()
|
||||||
|
path := fmt.Sprintf("/domain/%s/sslize", domain)
|
||||||
|
|
||||||
body := &qiniuModifyDomainCertReq{
|
body := &qiniuModifyDomainCertReq{
|
||||||
CertID: certId,
|
CertID: certId,
|
||||||
@ -102,7 +103,9 @@ type qiniuDomainInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *QiniuCDNDeployer) getDomainInfo() (*qiniuDomainInfo, error) {
|
func (d *QiniuCDNDeployer) getDomainInfo() (*qiniuDomainInfo, error) {
|
||||||
path := fmt.Sprintf("/domain/%s", getDeployString(d.option.DeployConfig, "domain"))
|
domain := d.option.DeployConfig.GetDomain()
|
||||||
|
|
||||||
|
path := fmt.Sprintf("/domain/%s", domain)
|
||||||
|
|
||||||
res, err := d.req(qiniuGateway+path, http.MethodGet, nil)
|
res, err := d.req(qiniuGateway+path, http.MethodGet, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -164,7 +167,8 @@ type qiniuModifyDomainCertReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *QiniuCDNDeployer) modifyDomainCert(certId string) error {
|
func (d *QiniuCDNDeployer) modifyDomainCert(certId string) error {
|
||||||
path := fmt.Sprintf("/domain/%s/httpsconf", getDeployString(d.option.DeployConfig, "domain"))
|
domain := d.option.DeployConfig.GetDomain()
|
||||||
|
path := fmt.Sprintf("/domain/%s/httpsconf", domain)
|
||||||
|
|
||||||
body := &qiniuModifyDomainCertReq{
|
body := &qiniuModifyDomainCertReq{
|
||||||
CertID: certId,
|
CertID: certId,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package domain
|
package domain
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
type ApplyConfig struct {
|
type ApplyConfig struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Access string `json:"access"`
|
Access string `json:"access"`
|
||||||
@ -16,6 +18,7 @@ type DeployConfig struct {
|
|||||||
Config map[string]any `json:"config"`
|
Config map[string]any `json:"config"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 以字符串形式获取配置项。
|
// 以字符串形式获取配置项。
|
||||||
//
|
//
|
||||||
// 入参:
|
// 入参:
|
||||||
@ -82,6 +85,25 @@ func (dc *DeployConfig) GetConfigOrDefaultAsBool(key string, defaultValue bool)
|
|||||||
return defaultValue
|
return defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDomain returns the domain from the deploy config
|
||||||
|
// if the domain is a wildcard domain, and wildcard is true, return the wildcard domain
|
||||||
|
func (dc *DeployConfig) GetDomain(wildcard ...bool) string {
|
||||||
|
val := dc.GetConfigAsString("domain")
|
||||||
|
if val == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.HasPrefix(val, "*") {
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(wildcard) > 0 && wildcard[0] {
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimPrefix(val, "*")
|
||||||
|
}
|
||||||
|
|
||||||
type KV struct {
|
type KV struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
|
12
main.go
12
main.go
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/usual2970/certimate/ui"
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/usual2970/certimate/internal/domains"
|
"github.com/usual2970/certimate/internal/domains"
|
||||||
"github.com/usual2970/certimate/internal/routes"
|
"github.com/usual2970/certimate/internal/routes"
|
||||||
"github.com/usual2970/certimate/internal/utils/app"
|
"github.com/usual2970/certimate/internal/utils/app"
|
||||||
|
"github.com/usual2970/certimate/ui"
|
||||||
|
|
||||||
_ "time/tzdata"
|
_ "time/tzdata"
|
||||||
)
|
)
|
||||||
@ -25,6 +26,12 @@ func main() {
|
|||||||
|
|
||||||
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())
|
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())
|
||||||
|
|
||||||
|
// 获取启动命令中的http参数
|
||||||
|
var httpFlag string
|
||||||
|
flag.StringVar(&httpFlag, "http", "127.0.0.1:8090", "HTTP server address")
|
||||||
|
// "serve"影响解析
|
||||||
|
_ = flag.CommandLine.Parse(os.Args[2:])
|
||||||
|
|
||||||
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
|
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
|
||||||
// enable auto creation of migration files when making collection changes in the Admin UI
|
// enable auto creation of migration files when making collection changes in the Admin UI
|
||||||
// (the isGoRun check is to enable it only during development)
|
// (the isGoRun check is to enable it only during development)
|
||||||
@ -47,6 +54,9 @@ func main() {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defer log.Println("Exit!")
|
||||||
|
log.Printf("Visit the website: http://%s", httpFlag)
|
||||||
|
|
||||||
if err := app.Start(); err != nil {
|
if err := app.Start(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version = "Certimate v0.2.5";
|
export const version = "Certimate v0.2.6";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user