Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add MongoDB support #463

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ FROM nginx:stable-alpine
COPY --from=build /usr/src/app/dist/ /usr/share/nginx/html
COPY --from=build /usr/src/app/docker/nginx.conf /etc/nginx/conf.d/default.conf

CMD sed -i "s#http://localhost:3333#$BACKEND_URL#g" /usr/share/nginx/html/main-*.js && nginx -g 'daemon off;'
# Replace the placeholder with the actual BACKEND_URL and start Nginx
CMD sed -i "s#http://localhost:3333#$BACKEND_URL#g" /usr/share/nginx/html/*.js && nginx -g 'daemon off;'
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DataService } from '../../../services/data.service';
import { ElectronServiceStub } from '../../../services/electron.service.stub';
import { Playlist } from './../../../../../shared/playlist.interface';
import { PlaylistInfoComponent } from './playlist-info.component';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';

describe('PlaylistInfoComponent', () => {
let component: PlaylistInfoComponent;
Expand All @@ -41,6 +42,7 @@ describe('PlaylistInfoComponent', () => {
],
declarations: [PlaylistInfoComponent, MockPipe(DatePipe)],
providers: [
provideHttpClient(withInterceptorsFromDi()),
MockProvider(MatSnackBar),
{ provide: MAT_DIALOG_DATA, useValue: {} },
{ provide: DataService, useClass: ElectronServiceStub },
Expand Down
36 changes: 36 additions & 0 deletions src/app/services/config.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { AppConfig } from '../../environments/environment';

@Injectable({
providedIn: 'root',
})
export class ConfigService {
private externalDB: boolean;
private baseUrl: string;

constructor(private http: HttpClient) {
this.baseUrl = AppConfig.BACKEND_URL;
this.checkDatabaseConnection();
}

private checkDatabaseConnection(): void {
this.http.get<{ status: string }>(`${this.baseUrl}/check-db-connection`).subscribe({
next: (response) => {
this.externalDB = response.status === 'success';
},
error: (error) => {
console.error('Error checking database connection:', error);
this.externalDB = false;
}
});
}

setExternalDB(value: boolean): void {
this.externalDB = value;
}

getExternalDB(): boolean {
return this.externalDB;
}
}
Loading
Loading