fix(systemd): Make default paths for runtime config and RPC socket compatible with systemd

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2024-12-23 17:51:20 +01:00
parent 850b83b1c0
commit 3ce39138cc
7 changed files with 20 additions and 7 deletions

View File

@@ -41,7 +41,7 @@ Please have a look at the [`cunicu config`](../usage/md/cunicu_config.md) comman
Currently, not all settings are runtime tunable.
Changed settings via the `cunicu config set` command are persisted in a runtime configuration file at `/var/lib/cunicu.runtime.yaml`.
Changed settings via the `cunicu config set` command are persisted in a runtime configuration file at `/var/lib/cunicu/runtime.yaml`.
So runtime changes will also be taken into account for subsequent starts of the daemon.
## DNS Auto-configuration

View File

@@ -21,7 +21,7 @@ backends:
rpc:
# Path to a Unix socket for management
# and monitoring of the cunicu daemon.
socket: /var/run/cunicu.sock
socket: /run/cunicu.sock
# Start of cunīcu daemon will block until
# its unblocked via the control socket.

View File

@@ -104,7 +104,7 @@ $defs:
description: |
Path to a Unix socket for management and monitoring of the cunīcu daemon.
type: string
default: /var/run/cunicu.sock
default: /run/cunicu.sock
wait:
description: |

View File

@@ -18,8 +18,6 @@ import (
)
const (
DefaultSocketPath = "/var/run/cunicu.sock"
// Ephemeral Port Range (RFC6056 Sect. 2.1)
EphemeralPortMin = (1 << 15) + (1 << 14)
EphemeralPortMax = (1 << 16) - 1

View File

@@ -0,0 +1,11 @@
// SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
// SPDX-License-Identifier: Apache-2.0
//go:build !unix
package config
const DefaultSocketPath = "cunicu.sock"
//nolint:gochecknoglobals
var RuntimeConfigFile = "runtime.yaml"

View File

@@ -1,7 +1,11 @@
// SPDX-FileCopyrightText: 2023-2024 Steffen Vogel <post@steffenvogel.de>
// SPDX-License-Identifier: Apache-2.0
//go:build unix
package config
const DefaultSocketPath = "/run/cunicu.sock"
//nolint:gochecknoglobals
var RuntimeConfigFile = "/var/lib/cunicu.runtime.yaml"
var RuntimeConfigFile = "/var/lib/cunicu/runtime.yaml"

View File

@@ -96,7 +96,7 @@ func NewAgent(m *g.Network, name string, opts ...g.Option) (*Agent, error) {
func (a *Agent) Start(_, dir string, args ...any) (err error) {
cfgPath := fmt.Sprintf("%s/%s.yaml", dir, a.Name())
logPath := fmt.Sprintf("%s/%s.log", dir, a.Name())
rpcPath := fmt.Sprintf("/var/run/cunicu.%s.sock", a.Name())
rpcPath := fmt.Sprintf("/run/cunicu.%s.sock", a.Name())
// Create agent configuration
cfg := a.Config.Copy()