This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NewPointerValueMap converts a map[string]*T to a map[string]T, omitting nil pointers. | |
func NewPointerValueMap[K comparable, V any](src map[K]*V) map[K]V { | |
dst := make(map[K]V) | |
for k, ptr := range src { | |
if ptr != nil { | |
dst[k] = *ptr | |
} | |
} | |
return dst | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func VerifyDirectoryExists(dirPath string) error { | |
if fileInfo, err := os.Stat(dirPath); err != nil { | |
if os.IsNotExist(err) { | |
return fmt.Errorf("directory '%s' does not exist", dirPath) | |
} else { | |
return fmt.Errorf("error filestat on '%s': %w", dirPath, err) | |
} | |
} else if !fileInfo.IsDir() { | |
return fmt.Errorf("'%s' exists but is not a directory", dirPath) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2024 Neomantra BV | |
// | |
// Opinionated Reader/Writer wrappers | |
package nmio | |
import ( | |
"compress/gzip" | |
"io" | |
"os" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Grafana PDC -- private network tunnel | |
# This is templated by Terraform templatefile() | |
# https://grafana.com/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/configure-pdc/ | |
job "grafana-pdc" { | |
region = "global" | |
datacenters = ["${NOMAD_DATACENTER}"] | |
namespace = "${NOMAD_NAMESPACE}" | |
type = "service" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
worker_connections 4096; ## Default: 1024 | |
} | |
http { | |
# DEBUG: | |
map $uri $proxy_uri_base { | |
"~/crypto-proxy/(?<proxy_base>[^/]*)" $proxy_base; | |
default $uri; | |
} |
OlderNewer