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/ENV indicates production or staging, or when KRYPTIC_DISABLED=true.
  • Finds kryptic.json by 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.