mirror of
https://github.com/openziti/zrok.git
synced 2025-06-26 12:42:18 +02:00
parameterize zrokdir (#976)
This commit is contained in:
parent
f7d78a7bd9
commit
5308285cbd
@ -7,6 +7,12 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SetRootDirName allows setting a custom name for the root directory.
|
||||||
|
// This should be called before any other environment operations.
|
||||||
|
func SetRootDirName(name string) {
|
||||||
|
env_v0_4.SetRootDirName(name)
|
||||||
|
}
|
||||||
|
|
||||||
func LoadRoot() (env_core.Root, error) {
|
func LoadRoot() (env_core.Root, error) {
|
||||||
if assert, err := env_v0_4.Assert(); assert && err == nil {
|
if assert, err := env_v0_4.Assert(); assert && err == nil {
|
||||||
return env_v0_4.Load()
|
return env_v0_4.Load()
|
||||||
|
@ -6,12 +6,18 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var rootDirName = ".zrok"
|
||||||
|
|
||||||
|
func SetRootDirName(name string) {
|
||||||
|
rootDirName = ".zrok"
|
||||||
|
}
|
||||||
|
|
||||||
func rootDir() (string, error) {
|
func rootDir() (string, error) {
|
||||||
home, err := os.UserHomeDir()
|
home, err := os.UserHomeDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return filepath.Join(home, ".zrok"), nil
|
return filepath.Join(home, rootDirName), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func metadataFile() (string, error) {
|
func metadataFile() (string, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user