add ssl certificates and tests
This commit is contained in:
@@ -31,6 +31,8 @@ export interface SelfHostedConfigRequest {
|
||||
sshUser: string;
|
||||
deployPath: string;
|
||||
nginxSitesPath: string;
|
||||
sslEnabled: boolean;
|
||||
sslEmail: string;
|
||||
}
|
||||
|
||||
export interface SelfHostedConfigResponse {
|
||||
@@ -42,6 +44,8 @@ export interface SelfHostedConfigResponse {
|
||||
sshUser: string;
|
||||
deployPath: string;
|
||||
nginxSitesPath: string;
|
||||
sslEnabled: boolean;
|
||||
sslEmail: string;
|
||||
publicKey: string;
|
||||
deployedAt: string | null;
|
||||
createdAt: string;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
@@ -24,7 +25,7 @@ import { SelfHostedConfigResponse } from '../../core/models/deployment';
|
||||
imports: [
|
||||
NgIf, NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault, DatePipe, FormsModule, RouterModule,
|
||||
MatToolbarModule, MatButtonModule, MatIconModule,
|
||||
MatInputModule, MatFormFieldModule, MatSelectModule,
|
||||
MatInputModule, MatFormFieldModule, MatSelectModule, MatSlideToggleModule,
|
||||
MatCardModule, MatDividerModule, MatSnackBarModule, MatProgressSpinnerModule,
|
||||
],
|
||||
template: `
|
||||
@@ -185,6 +186,16 @@ import { SelfHostedConfigResponse } from '../../core/models/deployment';
|
||||
<input matInput [(ngModel)]="shNginxSitesPath" [disabled]="shSaving" />
|
||||
<mat-hint>Path to nginx sites-available directory</mat-hint>
|
||||
</mat-form-field>
|
||||
<div class="flex items-center gap-2 py-2">
|
||||
<mat-slide-toggle [(ngModel)]="shSslEnabled" [disabled]="shSaving" color="primary">
|
||||
SSL / HTTPS
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<mat-form-field appearance="outline" class="w-full" *ngIf="shSslEnabled">
|
||||
<mat-label>SSL Email (for Let's Encrypt)</mat-label>
|
||||
<input matInput type="email" [(ngModel)]="shSslEmail" [disabled]="shSaving" placeholder="admin@example.com" />
|
||||
<mat-hint>Used for Let's Encrypt certificate registration and renewal notices</mat-hint>
|
||||
</mat-form-field>
|
||||
<div class="bg-gray-50 rounded-lg p-3 space-y-2" *ngIf="shPublicKey">
|
||||
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wide">Public Key</div>
|
||||
<p class="text-xs text-gray-600">
|
||||
@@ -260,6 +271,8 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
shSshUser = '';
|
||||
shDeployPath = '/var/www/{domain}/public';
|
||||
shNginxSitesPath = '/etc/nginx/sites-available';
|
||||
shSslEnabled = false;
|
||||
shSslEmail = '';
|
||||
shPublicKey = '';
|
||||
shPublicKeyCopied = false;
|
||||
shDeployedAt: string | null = null;
|
||||
@@ -323,6 +336,8 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
this.shSshUser = c.sshUser;
|
||||
this.shDeployPath = c.deployPath;
|
||||
this.shNginxSitesPath = c.nginxSitesPath;
|
||||
this.shSslEnabled = c.sslEnabled;
|
||||
this.shSslEmail = c.sslEmail;
|
||||
this.shPublicKey = c.publicKey;
|
||||
this.shDeployedAt = c.deployedAt;
|
||||
},
|
||||
@@ -376,6 +391,8 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
sshUser: this.shSshUser,
|
||||
deployPath: this.shDeployPath,
|
||||
nginxSitesPath: this.shNginxSitesPath,
|
||||
sslEnabled: this.shSslEnabled,
|
||||
sslEmail: this.shSslEmail,
|
||||
}).pipe(takeUntil(this.destroy$))
|
||||
.subscribe({
|
||||
next: (config) => {
|
||||
@@ -408,6 +425,8 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
this.shSshUser = '';
|
||||
this.shDeployPath = '/var/www/{domain}/public';
|
||||
this.shNginxSitesPath = '/etc/nginx/sites-available';
|
||||
this.shSslEnabled = false;
|
||||
this.shSslEmail = '';
|
||||
this.shPublicKey = '';
|
||||
this.shPublicKeyCopied = false;
|
||||
this.shDeployedAt = null;
|
||||
|
||||
Reference in New Issue
Block a user