Pull local args into form
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -77,3 +77,6 @@ src/main/resources/cf-cli/
|
|||||||
test-output/
|
test-output/
|
||||||
target/
|
target/
|
||||||
frontend/package-lock.json
|
frontend/package-lock.json
|
||||||
|
|
||||||
|
# Frontend local development environment (contains sensitive credentials)
|
||||||
|
frontend/src/environments/environment.local.ts
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { DeployService } from './deploy.service';
|
import { DeployService } from './deploy.service';
|
||||||
@@ -11,7 +11,7 @@ import { environment } from '../environments/environment';
|
|||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrls: ['./app.component.css']
|
styleUrls: ['./app.component.css']
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent implements OnInit {
|
||||||
// Environment config
|
// Environment config
|
||||||
env = environment;
|
env = environment;
|
||||||
|
|
||||||
@@ -37,6 +37,22 @@ export class AppComponent {
|
|||||||
|
|
||||||
constructor(private deployService: DeployService) {}
|
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) {
|
onJarFileChange(event: any) {
|
||||||
this.jarFile = event.target.files[0];
|
this.jarFile = event.target.files[0];
|
||||||
}
|
}
|
||||||
|
|||||||
24
frontend/src/environments/environment.local.template.ts
Normal file
24
frontend/src/environments/environment.local.template.ts
Normal 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)
|
||||||
|
};
|
||||||
@@ -16,5 +16,8 @@ export const environment = {
|
|||||||
|
|
||||||
// UI Configuration
|
// UI Configuration
|
||||||
defaultLogsExpanded: true,
|
defaultLogsExpanded: true,
|
||||||
showDebugInfo: false
|
showDebugInfo: false,
|
||||||
|
|
||||||
|
// Form Defaults (ALWAYS disabled in production)
|
||||||
|
formDefaults: { enabled: false }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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 = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
|
||||||
@@ -16,5 +25,8 @@ export const environment = {
|
|||||||
|
|
||||||
// UI Configuration
|
// UI Configuration
|
||||||
defaultLogsExpanded: true,
|
defaultLogsExpanded: true,
|
||||||
showDebugInfo: false
|
showDebugInfo: false,
|
||||||
|
|
||||||
|
// Form Defaults (auto-populated from environment.local.ts in development only)
|
||||||
|
formDefaults: localDefaults
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user