Fixed relative path saving configs in wrong dir
This commit is contained in:
50
.gitea/workflows/build.yml
Normal file
50
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Build (artifact)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.25"
|
||||||
|
|
||||||
|
- name: Install protoc
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y protobuf-compiler
|
||||||
|
|
||||||
|
- name: Install Go protobuf plugins
|
||||||
|
run: |
|
||||||
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||||
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Read VERSION from Makefile
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
VERSION="$(awk -F':=' '/^VERSION[[:space:]]*:=/ {gsub(/[[:space:]]/,"",$2); print $2; exit}' Makefile)"
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Failed to read VERSION from Makefile" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make build
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: certman-${{ env.VERSION }}-amd64
|
||||||
|
path: certman-${{ env.VERSION }}-amd64
|
||||||
|
if-no-files-found: error
|
||||||
@@ -2,7 +2,6 @@ package client
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
@@ -13,13 +12,6 @@ import (
|
|||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
tls = flag.Bool("tls", false, "Connection uses TLS if true, else plain TCP")
|
|
||||||
caFile = flag.String("ca_file", "", "The file containing the CA root cert file")
|
|
||||||
serverAddr = flag.String("addr", "localhost:50051", "The server address in the format of host:port")
|
|
||||||
serverHostOverride = flag.String("server_host_override", "x.test.example.com", "The server name used to verify the hostname returned by the TLS handshake")
|
|
||||||
)
|
|
||||||
|
|
||||||
func SendHook(domain string) {
|
func SendHook(domain string) {
|
||||||
conn, err := grpc.NewClient(
|
conn, err := grpc.NewClient(
|
||||||
"unix:///run/certman.sock",
|
"unix:///run/certman.sock",
|
||||||
|
|||||||
@@ -98,14 +98,9 @@ func LoadConfig() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch config.GetString("App.mode") {
|
if config.GetString("App.mode") == "server" {
|
||||||
case "server":
|
|
||||||
config.SetConfigType("toml")
|
config.SetConfigType("toml")
|
||||||
config.SetConfigFile("server.conf")
|
config.SetConfigFile("/etc/certman/server.conf")
|
||||||
return config.MergeInConfig()
|
|
||||||
case "Client":
|
|
||||||
config.SetConfigType("toml")
|
|
||||||
config.SetConfigFile("Client.conf")
|
|
||||||
return config.MergeInConfig()
|
return config.MergeInConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,12 +163,8 @@ func WriteConfig(filePath string, config *viper.Viper) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteMainConfig() error {
|
|
||||||
return WriteConfig("/etc/certman/certman.conf", config)
|
|
||||||
}
|
|
||||||
|
|
||||||
func WriteDomainConfig(config *viper.Viper) error {
|
func WriteDomainConfig(config *viper.Viper) error {
|
||||||
return WriteConfig(config.GetString("Domain.domain_name"), config)
|
return WriteConfig(filepath.Join("/etc/certman/domains", config.GetString("Domain.domain_name")+".conf"), config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveDomainConfigs writes every loaded domain config back to disk.
|
// SaveDomainConfigs writes every loaded domain config back to disk.
|
||||||
|
|||||||
Reference in New Issue
Block a user