Skip to main content

Overview

CompuTécnicos uses environment variables to configure all aspects of the application. Variables are loaded from a .env file in the project root.
Never commit your .env file to version control. Always use .env.example as a template and create your own .env file locally.

Quick Start

Copy the example file and customize it:
cp .env.example .env
Then edit .env with your specific values.

Application Ports

These variables control which ports the application services use:
APP_PORT
string
default:"8080"
The port where the main application will be accessible. Access the application at http://localhost:8080.
DB_PORT
string
default:"3306"
Port for the MySQL database server. Standard MySQL port is 3306.
PMA_PORT
string
default:"8081"
Port for phpMyAdmin interface. Access at http://localhost:8081.

Database Configuration

Database connection settings:
DB_NAME
string
default:"computecnicos"
required
The MySQL database name. This database must exist before starting the application.
DB_USER
string
default:"computecnicos_user"
required
MySQL username for application database access.
DB_PASS
string
default:"computecnicos_secret"
required
Password for the database user.
Use a strong password in production. Never use the default value.
MYSQL_ROOT_PASSWORD
string
default:"root_secret"
required
Root password for MySQL server (Docker only).
Critical security setting. Use a strong, unique password.

PayPal Integration

Configure PayPal payment processing:
PAYPAL_CLIENT_ID
string
default:"your_paypal_client_id"
required
Your PayPal application Client ID. Obtain this from the PayPal Developer Dashboard.
PAYPAL_CLIENT_SECRET
string
default:"your_paypal_client_secret"
required
Your PayPal application Client Secret.
Keep this secret secure. Never expose it in client-side code or commit it to version control.
PAYPAL_ENVIRONMENT
string
default:"sandbox"
PayPal environment mode. Use sandbox for testing and production for live transactions.Valid values:
  • sandbox - Test environment with fake transactions
  • production - Live environment with real money

Google OAuth

Enable Google Sign-In functionality:
GOOGLE_CLIENT_ID
string
required
Google OAuth 2.0 Client ID. Obtain from Google Cloud Console.Example: 123456789-abcdefghijklmnop.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET
string
required
Google OAuth 2.0 Client Secret.
Keep this secret secure. Never expose it publicly.

Electronic Invoicing

Configure Colombian electronic invoicing providers:
FE_PROVIDER
string
default:"alegra"
Electronic invoicing provider to use.Valid values:
  • alegra - Alegra invoicing service
  • siigo - Siigo invoicing service
FE_SIMULATE
boolean
default:"true"
Enable simulation mode for testing without creating real invoices.Set to false in production to generate actual invoices.

Alegra Configuration

ALEGRA_TOKEN
string
Alegra API authentication token. Required when FE_PROVIDER=alegra.
ALEGRA_EMAIL
string
Email address associated with your Alegra account.

Siigo Configuration

SIIGO_CLIENT_ID
string
Siigo OAuth Client ID. Required when FE_PROVIDER=siigo.
SIIGO_CLIENT_SECRET
string
Siigo OAuth Client Secret.
Keep this secret secure.
SIIGO_USERNAME
string
Siigo account username for API access.
SIIGO_PASSWORD
string
Siigo account password.
Store securely and never commit to version control.

Complete Example

Here’s a complete .env file example:
# ============================================
# Variables de entorno - CompuTécnicos Docker
# Copia este archivo como .env y ajusta los valores
# ============================================

# ─── Puertos ───
APP_PORT=8080
DB_PORT=3306
PMA_PORT=8081

# ─── Base de datos ───
DB_NAME=computecnicos
DB_USER=computecnicos_user
DB_PASS=computecnicos_secret
MYSQL_ROOT_PASSWORD=root_secret

# ─── PayPal (Sandbox) ───
PAYPAL_CLIENT_ID=your_paypal_client_id
PAYPAL_CLIENT_SECRET=your_paypal_client_secret
PAYPAL_ENVIRONMENT=sandbox

# ─── Facturación Electrónica ───
FE_PROVIDER=alegra
FE_SIMULATE=true
ALEGRA_TOKEN=
ALEGRA_EMAIL=
SIIGO_CLIENT_ID=
SIIGO_CLIENT_SECRET=
SIIGO_USERNAME=
SIIGO_PASSWORD=

# ─── Google OAuth ───
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

Environment-Specific Configuration

Development

APP_PORT=8080
PAYPAL_ENVIRONMENT=sandbox
FE_SIMULATE=true

Production

Always use production credentials and disable simulation modes in production.
APP_PORT=80
PAYPAL_ENVIRONMENT=production
FE_SIMULATE=false
# Use strong passwords
DB_PASS=your_very_strong_password
MYSQL_ROOT_PASSWORD=your_very_strong_root_password

Security Best Practices

1

Never Commit .env Files

Add .env to your .gitignore file to prevent accidentally committing secrets.
2

Use Strong Passwords

Generate strong, unique passwords for all credentials. Use a password manager.
3

Restrict File Permissions

Set restrictive permissions on your .env file:
chmod 600 .env
4

Rotate Credentials Regularly

Change passwords and API keys periodically, especially after team member changes.
5

Use Different Credentials per Environment

Never reuse production credentials in development or staging environments.
6

Monitor for Exposed Secrets

Use tools like git-secrets or GitHub’s secret scanning to detect accidentally committed secrets.

Validation

Verify your environment variables are loaded correctly:
<?php
// Check if a variable is set
if (!getenv('PAYPAL_CLIENT_ID')) {
    die('PAYPAL_CLIENT_ID not configured');
}

Troubleshooting

Variables Not Loading

If environment variables aren’t being recognized:
  1. Verify the .env file exists in the project root
  2. Check file permissions (should be readable by the web server)
  3. Ensure there are no syntax errors in the .env file
  4. Restart your web server or Docker containers after changes

Syntax Errors

Common .env syntax rules:
  • No spaces around the = sign: KEY=value (not KEY = value)
  • Use quotes for values with spaces: KEY="value with spaces"
  • Comments start with #
  • Empty values are allowed: KEY=

Build docs developers (and LLMs) love