service.env validation
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m16s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m36s

This commit is contained in:
2025-10-06 20:58:07 +13:00
parent af75b0b4ac
commit 709937bc61
3 changed files with 208 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#ifndef ENV_VALIDATOR_HPP
#define ENV_VALIDATOR_HPP
#include <string>
#include <vector>
namespace dropshell {
// Validates that a service's service.env file matches the template's service.env file
// Returns true if validation passes
// Returns false if there are mismatches (and fixes them by adding missing vars and commenting out extras)
//
// Parameters:
// template_service_env_path: Full path to the template's service.env file
// service_env_path: Full path to the service's service.env file
// missing_vars: Output parameter - list of variable names that were missing and added
// extra_vars: Output parameter - list of variable names that were extra and commented out
bool validate_and_fix_service_env(
const std::string& template_service_env_path,
const std::string& service_env_path,
std::vector<std::string>& missing_vars,
std::vector<std::string>& extra_vars
);
} // namespace dropshell
#endif // ENV_VALIDATOR_HPP