C++
Updated
krypticdev injects your project's secrets into the process environment with
setenv (POSIX) or _putenv_s (Windows) during development startup. Zero
dependencies, C++17. Outside development it is a no-op, and it never throws.
Install
CMake FetchContent:
include(FetchContent)
FetchContent_Declare(
krypticdev
GIT_REPOSITORY https://github.com/dev-kryptic/krypticdev-cpp.git
GIT_TAG v0.1.0
)
FetchContent_MakeAvailable(krypticdev)
target_link_libraries(your_app PRIVATE krypticdev)
Or add the sources as a subdirectory:
add_subdirectory(path/to/krypticdev-cpp)
target_link_libraries(your_app PRIVATE krypticdev)
Use
#include <krypticdev/krypticdev.hpp>
#include <cstdlib>
int main() {
krypticdev::inject(); // before anything reads the environment
const char* db_url = std::getenv("DATABASE_URL");
}
inject() returns a Result{injected, skipped, reason}. Existing environment
variables are never overwritten.
Behavior
- No-op when
CPP_ENV/APP_ENV/ENVIRONMENT/ENVindicates production or staging, or whenKRYPTIC_DISABLED=true. - Finds
kryptic.jsonby walking up from the working directory. - Never overwrites environment variables that are already set.
- macOS/Linux via unix socket, Windows via named pipe. Standard library and OS sockets only.
Environment variables override everything: KRYPTIC_PROJECT_ID, KRYPTIC_ENV,
KRYPTIC_SOCKET_PATH, KRYPTIC_TIMEOUT_MS, KRYPTIC_DISABLED, KRYPTIC_SILENT.