Compare commits
2 Commits
c9868b2108
...
a0813b6e84
| Author | SHA1 | Date | |
|---|---|---|---|
| a0813b6e84 | |||
| 596bb7ed3d |
@@ -7,7 +7,8 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-docker
|
||||||
|
container: node:26
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -15,7 +16,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.23"
|
go-version: "1.26"
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: agent/go.sum
|
cache-dependency-path: agent/go.sum
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-docker
|
||||||
|
container: node:26
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package grpcclient
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mrhid6/keymanager/agent/internal/grpc/pb"
|
"github.com/mrhid6/keymanager/agent/internal/grpc/pb"
|
||||||
@@ -22,6 +23,9 @@ type Client struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(serverURL string, useTLS bool) (*Client, error) {
|
func New(serverURL string, useTLS bool) (*Client, error) {
|
||||||
|
serverURL = strings.TrimPrefix(serverURL, "https://")
|
||||||
|
serverURL = strings.TrimPrefix(serverURL, "http://")
|
||||||
|
|
||||||
var dialOpts []grpc.DialOption
|
var dialOpts []grpc.DialOption
|
||||||
|
|
||||||
if useTLS {
|
if useTLS {
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ func newServer(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
host := os.Getenv("PUBLIC_HOST")
|
host := os.Getenv("PUBLIC_HOST")
|
||||||
if host == "" {
|
if host == "" {
|
||||||
host = "keymanager.example.com"
|
host = "https://keymanager.example.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
installCmd := fmt.Sprintf(
|
installCmd := fmt.Sprintf(
|
||||||
`curl -fsSL "https://%s/install?server_id=%s&token=%s" | bash`,
|
`curl -fsSL "%s/install?server_id=%s&token=%s" | bash`,
|
||||||
host, s.ServerID, token,
|
host, s.ServerID, token,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -218,6 +218,8 @@ SERVER_ID="%s"
|
|||||||
TOKEN="%s"
|
TOKEN="%s"
|
||||||
GITEA_HOST="%s"
|
GITEA_HOST="%s"
|
||||||
KM_HOST="%s"
|
KM_HOST="%s"
|
||||||
|
KM_HOST="${KM_HOST#https://}"
|
||||||
|
KM_HOST="${KM_HOST#http://}"
|
||||||
|
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
case "$ARCH" in
|
case "$ARCH" in
|
||||||
@@ -236,8 +238,9 @@ if [ -z "$LATEST" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION="${LATEST#agent/}"
|
VERSION="${LATEST#agent/}"
|
||||||
BINARY_URL="https://${GITEA_HOST}/mrhid6/keymanager/releases/download/${LATEST}/keymanager-agent-linux-${ARCH}"
|
LATEST_ENCODED="${LATEST/\//%%2F}"
|
||||||
CHECKSUM_URL="https://${GITEA_HOST}/mrhid6/keymanager/releases/download/${LATEST}/checksums.txt"
|
BINARY_URL="https://${GITEA_HOST}/mrhid6/keymanager/releases/download/${LATEST_ENCODED}/keymanager-agent-linux-${ARCH}"
|
||||||
|
CHECKSUM_URL="https://${GITEA_HOST}/mrhid6/keymanager/releases/download/${LATEST_ENCODED}/checksums.txt"
|
||||||
|
|
||||||
echo "Installing keymanager-agent ${VERSION} (${ARCH})..."
|
echo "Installing keymanager-agent ${VERSION} (${ARCH})..."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user