MCPcopy
hub / github.com/tailscale-dev/ScaleTail / _read_secret

Function _read_secret

services/netbox/config/configuration.py:20–27  ·  view source on GitHub ↗
(secret_name: str, default: str | None = None)

Source from the content-addressed store, hash-verified

18
19# Read secret from file
20def _read_secret(secret_name: str, default: str | None = None) -> str | None:
21 try:
22 f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8')
23 except EnvironmentError:
24 return default
25 else:
26 with f:
27 return f.readline().strip()
28
29# If the `map_fn` isn't defined, then the value that is read from the environment (or the default value if not found) is returned.
30# If the `map_fn` is defined, then `map_fn` is invoked and the value (that was read from the environment or the default value if not found)

Callers 1

configuration.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected