Compare commits

...

1 Commits

Author SHA1 Message Date
pratik
086a77daab Pull local args into form 2025-10-23 09:36:24 -05:00
5 changed files with 62 additions and 4 deletions

3
.gitignore vendored
View File

@@ -77,3 +77,6 @@ src/main/resources/cf-cli/
test-output/
target/
frontend/package-lock.json
# Frontend local development environment (contains sensitive credentials)
frontend/src/environments/environment.local.ts

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DeployService } from './deploy.service';
@@ -11,7 +11,7 @@ import { environment } from '../environments/environment';
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
export class AppComponent implements OnInit {
// Environment config
env = environment;
@@ -37,6 +37,22 @@ export class AppComponent {
constructor(private deployService: DeployService) {}
ngOnInit(): void {
// Auto-populate form fields from environment.local.ts (development only)
const formDefaults = environment.formDefaults as any;
if (formDefaults && formDefaults.enabled) {
this.apiEndpoint = formDefaults.apiEndpoint || '';
this.username = formDefaults.username || '';
this.password = formDefaults.password || '';
this.organization = formDefaults.organization || '';
this.space = formDefaults.space || '';
this.appName = formDefaults.appName || '';
this.skipSsl = formDefaults.skipSslValidation || false;
console.log('Form auto-populated from environment.local.ts');
}
}
onJarFileChange(event: any) {
this.jarFile = event.target.files[0];
}

View File

@@ -0,0 +1,24 @@
/**
* Local Development Form Defaults Template
*
* This file is a template for environment.local.ts which is gitignored.
* To use this feature:
* 1. Copy this file to environment.local.ts
* 2. Fill in your development credentials
* 3. The form will auto-populate in development mode
*
* NOTE: This only works in development. Production builds ignore these defaults.
*/
export const localFormDefaults = {
// Set to true to enable auto-population of form fields
enabled: false,
// Cloud Foundry / Tanzu Configuration
apiEndpoint: '', // e.g., 'https://api.cf.example.com'
username: '', // Your CF username
password: '', // Your CF password
organization: '', // Your CF organization
space: '', // Your CF space (e.g., 'dev', 'staging')
appName: '', // Default application name
skipSslValidation: false // Skip SSL validation (for development environments)
};

View File

@@ -16,5 +16,8 @@ export const environment = {
// UI Configuration
defaultLogsExpanded: true,
showDebugInfo: false
showDebugInfo: false,
// Form Defaults (ALWAYS disabled in production)
formDefaults: { enabled: false }
};

View File

@@ -1,3 +1,12 @@
// Try to import local form defaults (gitignored file with dev credentials)
let localDefaults: any = { enabled: false };
try {
const imported = require('./environment.local');
localDefaults = imported.localFormDefaults || { enabled: false };
} catch (e) {
// environment.local.ts doesn't exist, which is fine
}
export const environment = {
production: false,
@@ -16,5 +25,8 @@ export const environment = {
// UI Configuration
defaultLogsExpanded: true,
showDebugInfo: false
showDebugInfo: false,
// Form Defaults (auto-populated from environment.local.ts in development only)
formDefaults: localDefaults
};