Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 15e142d

Browse files
committed
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)
1 parent ac254c4 commit 15e142d

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This project implements a complete twelve-factor app architecture with clear sep
5050
┌─────────────────────────────────────────────────────────────┐
5151
│ Configuration Management │
5252
├─────────────────────────────────────────────────────────────┤
53-
│ • Environment Templates (local.env, production.env.tpl)
53+
│ • Environment Templates (local.env.tpl, production.env.tpl) │
5454
│ • Configuration Processing (configure-env.sh) │
5555
│ • Template Rendering (.tpl → actual configs) │
5656
└─────────────────────────────────────────────────────────────┘

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ clear separation between infrastructure provisioning and application deployment:
5959
┌─────────────────────────────────────────────────────────────┐
6060
│ Configuration Management │
6161
├─────────────────────────────────────────────────────────────┤
62-
│ • Environment Templates (local.env, production.env.tpl)
62+
│ • Environment Templates (local.env.tpl, production.env.tpl) │
6363
│ • Configuration Processing (configure-env.sh) │
6464
│ • Template Rendering (.tpl → actual configs) │
6565
└─────────────────────────────────────────────────────────────┘
@@ -87,7 +87,7 @@ clear separation between infrastructure provisioning and application deployment:
8787

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

9393
## Demo Tracker

docs/guides/integration-testing-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ time make configure-local
653653
- `infrastructure/cloud-init/` - VM provisioning files
654654

655655
These files are generated from templates in `infrastructure/config/templates/` using
656-
values from `infrastructure/config/environments/local.env`.
656+
values from `infrastructure/config/environments/local.env.tpl`.
657657

658658
### 1.7.2 Validate Generated Configuration
659659

infrastructure/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ terraform.tfplan.*
1414
config/environments/production.env
1515
config/environments/*.env
1616
!config/environments/*.env.tpl
17-
!config/environments/local.env
1817

1918
# Cloud-init generated files
2019
user-data.yaml

infrastructure/scripts/configure-env.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ VERBOSE="${VERBOSE:-false}"
1717
# shellcheck source=../../scripts/shell-utils.sh
1818
source "${PROJECT_ROOT}/scripts/shell-utils.sh"
1919

20+
# Setup local environment from template
21+
setup_local_environment() {
22+
local env_file="${CONFIG_DIR}/environments/local.env"
23+
local template_file="${CONFIG_DIR}/environments/local.env.tpl"
24+
25+
# Always regenerate local.env from template for consistency
26+
if [[ ! -f "${template_file}" ]]; then
27+
log_error "Local template not found: ${template_file}"
28+
exit 1
29+
fi
30+
31+
log_info "Creating local.env from template..."
32+
cp "${template_file}" "${env_file}"
33+
log_success "Local environment file created from template: ${env_file}"
34+
}
35+
2036
# Setup production environment from template
2137
setup_production_environment() {
2238
local env_file="${CONFIG_DIR}/environments/production.env"
@@ -55,9 +71,11 @@ setup_production_environment() {
5571
load_environment() {
5672
local env_file="${CONFIG_DIR}/environments/${ENVIRONMENT}.env"
5773

58-
# Special handling for production environment
74+
# Special handling for template-based environments
5975
if [[ "${ENVIRONMENT}" == "production" ]]; then
6076
setup_production_environment
77+
elif [[ "${ENVIRONMENT}" == "local" ]]; then
78+
setup_local_environment
6179
fi
6280

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

0 commit comments

Comments
 (0)