Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: [#1] rename local.env to local.env.tpl for consistency
- Renamed infrastructure/config/environments/local.env to local.env.tpl
- Updated configure-env.sh to process local.env.tpl template into local.env
- Modified .gitignore to exclude generated local.env while keeping template
- Updated documentation references in README, copilot-instructions, and guides
- Ensures consistent template-based configuration approach for all environments

Both local and production environments now use the same .env.tpl -> .env pattern:
- local.env.tpl (committed template) -> local.env (generated, git-ignored)
- production.env.tpl (template) -> production.env (generated, git-ignored)
  • Loading branch information
josecelano committed Jul 28, 2025
commit 15e142d9e0c727e6d67bf1250f455fb6594747c3
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This project implements a complete twelve-factor app architecture with clear sep
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Configuration Management β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β€’ Environment Templates (local.env, production.env.tpl) β”‚
β”‚ β€’ Environment Templates (local.env.tpl, production.env.tpl) β”‚
β”‚ β€’ Configuration Processing (configure-env.sh) β”‚
β”‚ β€’ Template Rendering (.tpl β†’ actual configs) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ clear separation between infrastructure provisioning and application deployment:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Configuration Management β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β€’ Environment Templates (local.env, production.env.tpl) β”‚
β”‚ β€’ Environment Templates (local.env.tpl, production.env.tpl) β”‚
β”‚ β€’ Configuration Processing (configure-env.sh) β”‚
β”‚ β€’ Template Rendering (.tpl β†’ actual configs) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Expand Down Expand Up @@ -87,7 +87,7 @@ clear separation between infrastructure provisioning and application deployment:

- **Complete Twelve-Factor Compliance**: All 12 factors implemented
- **Infrastructure/Application Separation**: Clean separation with `make infra-apply` and `make app-deploy`
- **Environment-based Configuration**: Template system with `local.env` and `production.env.tpl`
- **Environment-based Configuration**: Template system with `local.env.tpl` and `production.env.tpl`
- **Build/Release/Run Stages**: Proper separation of configuration processing, deployment, and execution

## Demo Tracker
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/integration-testing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ time make configure-local
- `infrastructure/cloud-init/` - VM provisioning files

These files are generated from templates in `infrastructure/config/templates/` using
values from `infrastructure/config/environments/local.env`.
values from `infrastructure/config/environments/local.env.tpl`.

### 1.7.2 Validate Generated Configuration

Expand Down
1 change: 0 additions & 1 deletion infrastructure/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ terraform.tfplan.*
config/environments/production.env
config/environments/*.env
!config/environments/*.env.tpl
!config/environments/local.env

# Cloud-init generated files
user-data.yaml
Expand Down
20 changes: 19 additions & 1 deletion infrastructure/scripts/configure-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ VERBOSE="${VERBOSE:-false}"
# shellcheck source=../../scripts/shell-utils.sh
source "${PROJECT_ROOT}/scripts/shell-utils.sh"

# Setup local environment from template
setup_local_environment() {
local env_file="${CONFIG_DIR}/environments/local.env"
local template_file="${CONFIG_DIR}/environments/local.env.tpl"

# Always regenerate local.env from template for consistency
if [[ ! -f "${template_file}" ]]; then
log_error "Local template not found: ${template_file}"
exit 1
fi

log_info "Creating local.env from template..."
cp "${template_file}" "${env_file}"
log_success "Local environment file created from template: ${env_file}"
}

# Setup production environment from template
setup_production_environment() {
local env_file="${CONFIG_DIR}/environments/production.env"
Expand Down Expand Up @@ -55,9 +71,11 @@ setup_production_environment() {
load_environment() {
local env_file="${CONFIG_DIR}/environments/${ENVIRONMENT}.env"

# Special handling for production environment
# Special handling for template-based environments
if [[ "${ENVIRONMENT}" == "production" ]]; then
setup_production_environment
elif [[ "${ENVIRONMENT}" == "local" ]]; then
setup_local_environment
fi

if [[ ! -f "${env_file}" ]]; then
Expand Down