mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-09 04:47:41 +00:00
add migrations (package, config, migrations), add exceptions filter for kodi, start VideoFiles module
This commit is contained in:
+19
-13
@@ -7,27 +7,33 @@ export class PathsConfig {
|
||||
}
|
||||
|
||||
public getStaticRequestsLogPath(): string {
|
||||
return join(
|
||||
this.getRootPath(),
|
||||
this.configService.getEnv('LOG_FILE_REQUESTS'),
|
||||
);
|
||||
return this.getPathByEnvKey('LOG_FILE_REQUESTS');
|
||||
}
|
||||
|
||||
public getStaticFolder(): string {
|
||||
return join(
|
||||
this.getRootPath(),
|
||||
this.configService.getEnv('STATIC_SERVE_FOLDER'),
|
||||
);
|
||||
return this.getPathByEnvKey('STATIC_SERVE_FOLDER');
|
||||
}
|
||||
|
||||
public getRecentSearchesFolder(): string {
|
||||
return join(
|
||||
this.getRootPath(),
|
||||
this.configService.getEnv('RECENT_SEARCHES_FOLDER'),
|
||||
);
|
||||
return this.getPathByEnvKey('RECENT_SEARCHES_FOLDER');
|
||||
}
|
||||
|
||||
private getPathByEnvKey(key: string) {
|
||||
const relPath = this.configService.getEnv(key);
|
||||
|
||||
return this.getPath(relPath);
|
||||
}
|
||||
|
||||
private getPath(relPath: string) {
|
||||
if (relPath[0] === '/') {
|
||||
//this is an absolute path
|
||||
return relPath;
|
||||
}
|
||||
|
||||
return join(this.getRootPath(), relPath);
|
||||
}
|
||||
|
||||
private getRootPath(): string {
|
||||
return join(__dirname, '../..');
|
||||
return this.configService.getEnv('PWD');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { DataSource, DataSourceOptions } from 'typeorm';
|
||||
import { configService } from './config.service';
|
||||
|
||||
/**
|
||||
* config for typeorm cli
|
||||
*/
|
||||
export default new DataSource(<DataSourceOptions>{
|
||||
type: configService.getTypeOrmConfig().type,
|
||||
database: configService.getTypeOrmConfig().database,
|
||||
migrations: ['migrations/*{.ts,.js}'],
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
import { LrtCategory } from '../KodiApi/LRT/LrtApiClient/Entity/lrt-category.entity';
|
||||
import { TitleEntity } from '../KodiApi/AllFiles/Entity/title.entity';
|
||||
import { FileEntity } from '../KodiApi/AllFiles/Entity/file.entity';
|
||||
import { ConfigService } from './config.service';
|
||||
import { EntityClassOrSchema } from '@nestjs/typeorm/dist/interfaces/entity-class-or-schema.type';
|
||||
import { TitleEntity } from '../VideoFiles/Entity/title.entity';
|
||||
import { FileEntity } from '../VideoFiles/Entity/file.entity';
|
||||
|
||||
export class TypeOrmConfig {
|
||||
constructor(configService: ConfigService) {
|
||||
|
||||
Reference in New Issue
Block a user