# 04-Feb-2026 — Deploy, Secrets and 4 more areas: 5 features and 1 fix [#146](https://github.com/nbarrett/ngx-ramblers/issues/146)

## [build 462](https://github.com/nbarrett/ngx-ramblers/actions/runs/21689372104) — [commit dff051b](https://github.com/nbarrett/ngx-ramblers/commit/dff051b465a53e2ebad3155ca3c6bf08b9eca8de)

_____

- Add fly.toml to Dockerfile so it's available in deployed environments
- Simplify fly deployment to read fly.toml directly instead of requiring fallback
- Fix Environment type usage in env-config and env-core
- Add FLICKR_SCRAPE_DUMP_DIR to Environment enum
(ref: #146)

### **secrets**: add database-first secrets loading for deployed servers ([#146](https://github.com/nbarrett/ngx-ramblers/issues/146))

Add loadSecretsWithFallback and loadSecretsForEnvironmentFromDatabase
to support reading secrets from the database ENVIRONMENTS config when
running on deployed servers. Falls back to file-based secrets for local
development.
Secrets are built from:
- Global aws config and secrets from EnvironmentsConfig
- Per-environment aws, mongo, and secrets from EnvironmentConfig
- MongoDB URI is constructed from mongo config fields

### **cli**: add GitHub secrets sync command for environment management ([#146](https://github.com/nbarrett/ngx-ramblers/issues/146))

Add ngx-cli github command with reconcile, sync, and push subcommands
to manage the CONFIGS_JSON GitHub secret from the database source of truth.
This enables regular syncing when environments are created or modified.

### **backup**: global AWS credentials, S3 path improvements, and DRY refactoring ([#146](https://github.com/nbarrett/ngx-ramblers/issues/146))

## User Guide
### Global Backup Configuration
You can now configure global AWS credentials in the Settings tab under 'Global AWS S3 Configuration'.
This allows a single set of credentials to manage backups across all environments, with per-environment
settings used as fallback.
**New Settings Fields:**
- Access Key ID
- AWS access key with S3 permissions
- Secret Access Key
- Corresponding secret key
### Backup Improvements
- Backups are now organised by environment and timestamp in S3: `<environment>/<timestamp>/`
- Upload progress is displayed in the History tab logs
- Server-side logging reduced to show only meaningful operations
### Environment Configuration
- MongoDB URI can now be pasted directly
- fields auto-populate from the connection string
- All environment configs support AWS, MongoDB, and Fly.io credentials in one place
## Technical Changes
### S3 Path Construction
- New `backup-paths.ts` with pure utility functions for S3 key construction
- 22 unit tests covering path building and parsing
- Simplified path structure: `<env>/<timestamp>` instead of `<env>/<db>/<timestamp>`
### DRY Refactoring
- Consolidated `uploadDirectoryToS3` from 3 duplicate implementations into `server/lib/aws/s3-utils.ts`
- Added factory functions: `createEmptyAwsConfig()`, `createEmptyMongoConfig()`
- `EnvironmentBackupConfig` and `BackupConfig` now type aliases for `EnvironmentConfig` and `EnvironmentsConfig`
- Eliminated inline interface definitions in favour of model imports
### Credential Resolution
- `preferredCredentials()` method prioritises global AWS credentials over per-environment
- `preferredBucket()` and `preferredRegion()` follow same pattern
- `bucketExists()` check prevents AccessDenied errors when credentials lack CreateBucket permission
### Code Quality
- Removed verbose debug logging from backup controller and websocket server
- Method naming follows project conventions (no 'get' prefix)
- All config model types centralised in `environment-config.model.ts`

### **environment-setup**: comprehensive environment management overhaul with API and MongoDB migration ([#146](https://github.com/nbarrett/ngx-ramblers/issues/146))

Introduces new environment configuration API, MongoDB cluster-based config, and enhanced UI with vendor branding and dashboard links.
**New Environment Configuration API:**
- RESTful endpoints for reading and writing environment configurations
- `EnvironmentConfigService` for centralised config management
- Separation of concerns: environment config extracted from backup/restore
- Config initialisation from files with validation and error handling
**MongoDB Configuration Migration:**
- Migrate from `uri` field to `cluster` field in MongoDB configuration
- Cluster field stores cluster name without .mongodb.net suffix
- Database migration script (20260201000000) converts existing records
- Backward compatible: handles both legacy URI and new cluster formats
- Improved regex parsing for cluster extraction from URIs
**Enhanced Environment Setup UI:**
- Vendor logos in all configuration section headings
- Ramblers logo dynamically loaded from System Settings
- AWS, MongoDB, and Fly.io static brand logos
- External link buttons for quick dashboard access:
- AWS S3 Console (global and per-environment bucket views)
- MongoDB Atlas dashboard
- Fly.io app-specific dashboard
- Deployed application URL
- Environment list alphabetically sorted by name
- Improved visual spacing and button styling consistency
**Backend Architecture Improvements:**
- New `environments-config.ts` module for config operations
- Enhanced `config-initializer` with cluster field population
- Updated backup/restore service to use new config service
- CLI tools migrated to cluster-based MongoDB configuration
- Fly.toml path resolution fixed for compiled environments
**Technical Implementation:**
- New `EnvironmentConfig` and `EnvironmentsConfig` models
- Integration with SystemConfigService for dynamic Ramblers logo
- Custom `.btn-outline-flyio` styling for brand consistency
- Shared `sortBy()` utility for environment sorting
- Type-safe API routes with proper error handling

### **paths**: use resolveClientPath for non-vcs file access ([#146](https://github.com/nbarrett/ngx-ramblers/issues/146))

Fix path resolution for secrets and configs.json files when running
in production mode where code executes from ts-gen directory.