Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

587 B
Raw Blame
package config

import (
	"path/filepath"

	"github.com/rcourtman/pulse-go-rewrite/internal/securityutil"
)

func resolveSharedInstallationDataDir(configDir string) (string, error) {
	normalizedConfigDir, err := securityutil.NormalizeStorageDir(ResolveRuntimeDataDir(configDir))
	if err != nil {
		return "", err
	}

	orgsDir := filepath.Dir(normalizedConfigDir)
	if filepath.Base(orgsDir) != "orgs" {
		return normalizedConfigDir, nil
	}

	orgID := filepath.Base(normalizedConfigDir)
	if !isValidOrgID(orgID) {
		return normalizedConfigDir, nil
	}

	return filepath.Dir(orgsDir), nil
}