Parameterisation of python settings
This commit is contained in:
18
.env.example
18
.env.example
@@ -1,8 +1,8 @@
|
||||
# Database Configuration
|
||||
MYSQL_ROOT_PASSWORD=your_mysql_root_password_here
|
||||
DB_USER=ppr_user
|
||||
DB_USER=your_database_user_here
|
||||
DB_PASSWORD=your_database_password_here
|
||||
DB_NAME=ppr
|
||||
DB_NAME=your_database_name_here
|
||||
DB_PORT=3306
|
||||
|
||||
# API Configuration
|
||||
@@ -13,6 +13,20 @@ API_V1_STR=/api/v1
|
||||
PROJECT_NAME=Airfield PPR API NextGen
|
||||
API_PORT_EXTERNAL=8001
|
||||
|
||||
# Mail Configuration
|
||||
MAIL_HOST=your_mail_host_here
|
||||
MAIL_PORT=465
|
||||
MAIL_USERNAME=your_mail_username_here
|
||||
MAIL_PASSWORD=your_mail_password_here
|
||||
MAIL_FROM=your_mail_from_address_here
|
||||
MAIL_FROM_NAME=your_mail_from_name_here
|
||||
|
||||
# Application settings
|
||||
BASE_URL=your_base_url_here
|
||||
|
||||
# Redis (optional)
|
||||
REDIS_URL=
|
||||
|
||||
# Web Configuration
|
||||
WEB_PORT_EXTERNAL=8082
|
||||
|
||||
|
||||
11
README.md
11
README.md
@@ -40,12 +40,12 @@ cd nextgen
|
||||
- **Public Web Interface**: http://localhost:8082
|
||||
- **Admin Interface**: http://localhost:8082/admin.html
|
||||
- **Reports Interface**: http://localhost:8082/reports.html
|
||||
- **Database**: localhost:3307 (user: ppr_user, password: ppr_password123)
|
||||
- **Database**: localhost:3307 (user: ppr_user, password: [configured in .env])
|
||||
- **phpMyAdmin**: http://localhost:8083
|
||||
|
||||
### 3. Default Login
|
||||
- **Username**: admin
|
||||
- **Password**: admin123
|
||||
- **Password**: [configured in database - see init_db.sql]
|
||||
|
||||
## API Endpoints
|
||||
|
||||
@@ -129,12 +129,7 @@ uvicorn app.main:app --reload
|
||||
# Connect to database
|
||||
docker exec -it ppr_nextgen_db mysql -u ppr_user -p ppr_nextgen
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f api
|
||||
docker-compose logs -f db
|
||||
|
||||
# Restart services
|
||||
docker-compose restart
|
||||
# When prompted for password, use the value from .env (DB_PASSWORD)
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
@@ -5,28 +5,28 @@ from typing import Optional
|
||||
class Settings(BaseSettings):
|
||||
# Database settings
|
||||
db_host: str = "db" # Docker service name
|
||||
db_user: str = "ppr_user"
|
||||
db_password: str = "ppr_password123"
|
||||
db_name: str = "ppr_nextgen"
|
||||
db_user: str
|
||||
db_password: str
|
||||
db_name: str
|
||||
db_port: int = 3306
|
||||
|
||||
# Security settings
|
||||
secret_key: str = "your-secret-key-change-this-in-production"
|
||||
secret_key: str
|
||||
algorithm: str = "HS256"
|
||||
access_token_expire_minutes: int = 30
|
||||
|
||||
# Mail settings
|
||||
mail_host: str = "send.one.com"
|
||||
mail_host: str
|
||||
mail_port: int = 465
|
||||
mail_username: str = "noreply@swansea-airport.wales"
|
||||
mail_password: str = "SASAGoForward2155"
|
||||
mail_from: str = "noreply@swansea-airport.wales"
|
||||
mail_from_name: str = "Swansea Airport"
|
||||
mail_username: str
|
||||
mail_password: str
|
||||
mail_from: str
|
||||
mail_from_name: str
|
||||
|
||||
# Application settings
|
||||
api_v1_str: str = "/api/v1"
|
||||
project_name: str = "Airfield PPR API"
|
||||
base_url: str = "https://pprdev.swansea-airport.wales"
|
||||
base_url: str
|
||||
|
||||
# Redis settings (for future use)
|
||||
redis_url: Optional[str] = None
|
||||
|
||||
@@ -30,6 +30,14 @@ services:
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: ${ACCESS_TOKEN_EXPIRE_MINUTES}
|
||||
API_V1_STR: ${API_V1_STR}
|
||||
PROJECT_NAME: ${PROJECT_NAME}
|
||||
MAIL_HOST: ${MAIL_HOST}
|
||||
MAIL_PORT: ${MAIL_PORT}
|
||||
MAIL_USERNAME: ${MAIL_USERNAME}
|
||||
MAIL_PASSWORD: ${MAIL_PASSWORD}
|
||||
MAIL_FROM: ${MAIL_FROM}
|
||||
MAIL_FROM_NAME: ${MAIL_FROM_NAME}
|
||||
BASE_URL: ${BASE_URL}
|
||||
REDIS_URL: ${REDIS_URL}
|
||||
ports:
|
||||
- "${API_PORT_EXTERNAL}:8000" # Use different port to avoid conflicts with existing system
|
||||
depends_on:
|
||||
|
||||
Reference in New Issue
Block a user