Skip to content

Commit

Permalink
Merge commit 'a6bcd9f653382fb8fd56596bc8e6559f3c32c2c8' into release/…
Browse files Browse the repository at this point in the history
…v0.12.7
  • Loading branch information
Dot-Liu committed May 10, 2023
2 parents 81f2e4d + a6bcd9f commit acc45b5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
26 changes: 13 additions & 13 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
stages:
- notice
- check
# - check
- build
- deploy
- publish
Expand Down Expand Up @@ -30,23 +30,23 @@ merge-informer: # 飞书回调
curl -X POST -H "Content-Type: application/json" \
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:${CI_PROJECT_NAME}\\n提交人:${GITLAB_USER_NAME}\\n提交信息:${CI_MERGE_REQUEST_TITLE}\\n合并分支信息:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -> ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}\\n差异性地址:${DIFF_URL}\\n请及时review代码\"}}" \
https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c
checker:
stage: check
rules:
- if: $CI_COMMIT_BRANCH=="develop"
script:
- set +e
- go mod tidy
- go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.data -timeout=1m ./...
- golangci-lint run --timeout=3m --out-format checkstyle --issues-exit-code 0 ./... > report.xml
- sonar-scanner
# checker:
# stage: check
# rules:
# - if: $CI_COMMIT_BRANCH=="develop"
# script:
# - set +e
# - go mod tidy
# - go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.data -timeout=1m ./...
# - golangci-lint run --timeout=3m --out-format checkstyle --issues-exit-code 0 ./... > report.xml
# - sonar-scanner
builder:
stage: build
rules:
- if: $CI_COMMIT_BRANCH=="develop"
when: on_success
# when: on_success
- if: $CI_COMMIT_BRANCH=="test"
when: on_success
# when: on_success
script:
- sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod
- go mod tidy
Expand Down
2 changes: 1 addition & 1 deletion drivers/certs/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func Register(register eosc.IExtenderDriverRegister) {
register.RegisterExtenderDriver("ssl-server", newFactory())
_ = register.RegisterExtenderDriver("ssl-server", newFactory())
//setting.RegisterSetting("ssl-server", controller)
}

Expand Down
23 changes: 18 additions & 5 deletions drivers/certs/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package certs
import (
"crypto/tls"
"crypto/x509"

"github.com/eolinker/apinto/certs"
"github.com/eolinker/apinto/drivers"
"github.com/eolinker/apinto/utils"
Expand All @@ -20,6 +19,18 @@ type Worker struct {
config *Config
}

func (w *Worker) Check(conf interface{}, _ map[eosc.RequireId]eosc.IWorker) error {
config, ok := conf.(*Config)
if !ok {
return eosc.ErrorConfigIsNil
}
_, err := parseCert(config.Key, config.Pem)
if err != nil {
return err
}
return nil
}

func (w *Worker) Destroy() error {

controller.Del(w.Id())
Expand Down Expand Up @@ -77,11 +88,13 @@ func genCert(key, pem []byte) (*tls.Certificate, error) {
if err != nil {
return nil, err
}
if certificate.Leaf == nil {

x509Cert, err := x509.ParseCertificate(certificate.Certificate[0])
if err != nil {
return nil, err
x509Cert, err := x509.ParseCertificate(certificate.Certificate[0])
if err != nil {
return nil, err
}
certificate.Leaf = x509Cert
}
certificate.Leaf = x509Cert
return &certificate, nil
}

0 comments on commit acc45b5

Please sign in to comment.