Compare commits

...

2 Commits

Author SHA1 Message Date
1a331963d6 Removing lint for now
Some checks failed
Anatid Blog CI Workflow / test (./backend) (push) Successful in 27s
Anatid Blog CI Workflow / test (./frontend) (push) Successful in 29s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Failing after 36s
Anatid Blog CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/anatid-blog-frontend, ./frontend) (push) Successful in 43s
Anatid Blog CI Workflow / deploy (push) Has been skipped
2025-03-28 08:55:58 +00:00
24eb5dad55 Adding config 2025-03-28 08:55:24 +00:00
7 changed files with 37 additions and 19 deletions

View File

@ -25,9 +25,9 @@ jobs:
- name: Clean install - name: Clean install
run: npm ci run: npm ci
working-directory: ./${{ matrix.workingdir }} working-directory: ./${{ matrix.workingdir }}
- name: Run lint # - name: Run lint
run: npm run lint # run: npm run lint
working-directory: ./${{ matrix.workingdir }} # working-directory: ./${{ matrix.workingdir }}
- name: Run tests - name: Run tests
run: npm run test run: npm run test
working-directory: ./${{ matrix.workingdir }} working-directory: ./${{ matrix.workingdir }}

View File

@ -3,11 +3,15 @@ import { AppController } from './app.controller';
import { AppService } from './app.service'; import { AppService } from './app.service';
import { PostsModule } from './posts/posts.module'; import { PostsModule } from './posts/posts.module';
import { DatabaseModule } from './database/database.module'; import { DatabaseModule } from './database/database.module';
import configuration from './config/configuration';
@Module({ @Module({
imports: [ imports: [
ConfigModule.forRoot({
load: [configuration],
}),
DatabaseModule,
PostsModule, PostsModule,
DatabaseModule
], ],
controllers: [AppController], controllers: [AppController],
providers: [AppService], providers: [AppService],

View File

@ -0,0 +1,10 @@
export default () => ({
port: parseInt(process.env.BLOG_PORT, 10) || 3000,
database: {
host: process.env.POSTGRES_HOST,
port: parseInt(process.env.POSTGRES_PORT, 10) || 5432,
name: process.env.BLOG_DB_NAME,
user: process.env.BLOG_DB_USER,
password: process.env.BLOG_DB_PASSWORD,
},
});

View File

@ -1,19 +1,22 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { ConfigModule, ConfigService } from '@nestjs/config'; import { ConfigModule, ConfigService } from '@nestjs/config';
import configuration from './config/configuration';
@Module({ @Module({
imports: [ imports: [
ConfigModule.forRoot(), ConfigModule.forRoot({
load: [configuration]
}),
TypeOrmModule.forRootAsync({ TypeOrmModule.forRootAsync({
imports: [ConfigModule], imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({ useFactory: (configService: ConfigService) => ({
type: 'postgres', type: 'postgres',
host: configService.get('POSTGRES_HOST'), host: configService.get('database.host'),
port: configService.get('POSTGRES_PORT'), port: configService.get('database.port'),
username: configService.get('BLOG_DB_USER'), username: configService.get('database.user'),
password: configService.get('BLOG_DB_PASSWORD'), password: configService.get('database.password'),
database: configService.get('BLOG_DB_NAME'), database: configService.get('database.name'),
entities: [__dirname + '/../**/*.entity{.ts,.js}'], entities: [__dirname + '/../**/*.entity{.ts,.js}'],
synchronize: true, // Be cautious about using synchronize in production synchronize: true, // Be cautious about using synchronize in production
}), }),

View File

@ -6,4 +6,5 @@ async function bootstrap() {
app.enableCors(); app.enableCors();
await app.listen(process.env.PORT ?? 3000); await app.listen(process.env.PORT ?? 3000);
} }
bootstrap();
await bootstrap();

View File

@ -1,7 +1,7 @@
export class Post { export class Post {
id: number; id: number;
title: string; title: string;
uri: string; uri: string;
body: string; body: string;
created: Date; created: Date;
} }

View File

@ -4,6 +4,6 @@ import { PostsService } from './posts.service';
@Module({ @Module({
controllers: [PostsController], controllers: [PostsController],
providers: [PostsService] providers: [PostsService],
}) })
export class PostsModule {} export class PostsModule {}