#ifndef SRC_NODE_DOTENV_H_ #define SRC_NODE_DOTENV_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "util-inl.h" #include "v8.h" #include namespace node { class Dotenv { public: enum ParseResult { Valid, FileError, InvalidContent }; struct env_file_data { std::string path; bool is_optional; }; Dotenv() = default; Dotenv(const Dotenv& d) = delete; Dotenv(Dotenv&& d) noexcept = default; Dotenv& operator=(Dotenv&& d) noexcept = default; Dotenv& operator=(const Dotenv& d) = delete; ~Dotenv() = default; void ParseContent(const std::string_view content); ParseResult ParsePath(const std::string_view path); void AssignNodeOptionsIfAvailable(std::string* node_options) const; v8::Maybe SetEnvironment(Environment* env); v8::MaybeLocal ToObject(Environment* env) const; // The names of the variables parsed from the env files. std::vector GetKeys() const; static std::vector GetDataFromArgs( const std::vector& args); private: std::map store_; }; namespace per_process { // The env files passed with --env-file and --env-file-if-exists. extern Dotenv dotenv_file; } // namespace per_process } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_NODE_DOTENV_H_