Add more info about config options

This commit is contained in:
rubikscraft 2022-09-01 20:25:40 +02:00
parent c8c0443940
commit b23e5c6660
No known key found for this signature in database
GPG key ID: 1463EBE9200A5CD4
8 changed files with 34 additions and 9 deletions

View file

@ -58,8 +58,8 @@ Every featured marked here should work in the latest release.
- [x] Deletable images
- [x] Proper DB migrations
- [x] Show own images in list
- [X] Correct previews on chats
- [ ] Correct previews on chats
- [ ] Expiring images
- [ ] White mode
- [ ] ShareX endpoint
@ -97,11 +97,17 @@ services:
# PICSUR_ADMIN_PASSWORD: picsur
## Optional, random secret will be generated if not set
# PICSUR_JWT_SECRET: CHANGE_ME
# PICSUR_JWT_EXPIRY: 1d
# PICSUR_JWT_EXPIRY: 7d
## Maximum accepted size for uploads in bytes
# PICSUR_MAX_FILE_SIZE: 128000000
## No need to touch this, unless you use a custom frontend
# PICSUR_STATIC_FRONTEND_ROOT: "/picsur/frontend/dist"
## Warning: Verbose mode might log sensitive data
# PICSUR_VERBOSE: "true"
restart: unless-stopped
picsur_postgres:
image: postgres:14-alpine

View file

@ -48,7 +48,10 @@ export class RolesModule implements OnModuleInit {
this.logger.verbose(`Ensuring system role "${systemRole}" exists`);
const exists = await this.rolesService.exists(systemRole);
if (exists) continue;
if (exists) {
this.logger.verbose(`System role "${systemRole}" already exists`);
continue;
}
const newRole = await this.rolesService.create(
systemRole,

View file

@ -10,7 +10,7 @@ export class AuthConfigService {
public getDefaultAdminPassword(): string {
return ParseString(
this.configService.get(`${EnvPrefix}ADMIN_PASSWORD`),
'admin',
'picsur',
);
}
}

View file

@ -13,6 +13,7 @@ export class HostConfigService {
constructor(private readonly configService: ConfigService) {
this.logger.log('Production: ' + this.isProduction());
this.logger.log('Verbose: ' + this.isVerbose());
this.logger.log('Host: ' + this.getHost());
this.logger.log('Port: ' + this.getPort());
this.logger.log('Demo: ' + this.isDemo());
@ -42,6 +43,10 @@ export class HostConfigService {
return ParseBool(this.configService.get(`${EnvPrefix}PRODUCTION`), false);
}
public isVerbose() {
return ParseBool(this.configService.get(`${EnvPrefix}VERBOSE`), false);
}
public getVersion() {
return ParseString(this.configService.get(`npm_package_version`), '0.0.0');
}

View file

@ -69,9 +69,9 @@ export class MainExceptionFilter implements ExceptionFilter {
} else if (exception instanceof ForbiddenException) {
return Fail(FT.Permission, exception);
} else if (exception instanceof NotFoundException) {
return Fail(FT.NotFound, exception);
return Fail(FT.RouteNotFound, exception);
} else if (exception instanceof MethodNotAllowedException) {
return Fail(FT.NotFound, exception);
return Fail(FT.RouteNotFound, exception);
} else if (exception instanceof Error) {
return Fail(FT.Internal, exception);
} else {

View file

@ -5,7 +5,7 @@ import { HostConfigService } from '../config/early/host.config.service';
export class PicsurLoggerService extends ConsoleLogger {
constructor(hostService: HostConfigService) {
super();
if (hostService.isProduction()) {
if (hostService.isProduction() && !hostService.isVerbose()) {
super.setLogLevels(['error', 'warn', 'log']);
}
}

View file

@ -11,6 +11,7 @@ export enum FT {
UsrValidation = 'usrvalidation',
Permission = 'permission',
NotFound = 'notfound',
RouteNotFound = 'routenotfound',
Conflict = 'conflict',
Internal = 'internal',
Authentication = 'authentication',
@ -67,6 +68,11 @@ const FTProps: {
code: 404,
message: 'Item(s) could not be found',
},
[FT.RouteNotFound]: {
important: false,
code: 404,
message: 'Route not found',
},
[FT.Conflict]: {
important: false,
code: 409,

View file

@ -10,7 +10,6 @@ services:
# PICSUR_PORT: 8080
PICSUR_DB_HOST: picsur_postgres
# PICSUR_DB_PORT: 5432
# PICSUR_DB_USERNAME: picsur
# PICSUR_DB_PASSWORD: picsur
@ -18,11 +17,17 @@ services:
# PICSUR_ADMIN_PASSWORD: picsur
## Optional, random secret will be generated if not set
# PICSUR_JWT_SECRET: CHANGE_ME
# PICSUR_JWT_EXPIRY: 1d
# PICSUR_JWT_EXPIRY: 7d
## Maximum accepted size for uploads in bytes
# PICSUR_MAX_FILE_SIZE: 128000000
## No need to touch this, unless you use a custom frontend
# PICSUR_STATIC_FRONTEND_ROOT: "/picsur/frontend/dist"
## Warning: Verbose mode might log sensitive data
# PICSUR_VERBOSE: "true"
restart: unless-stopped
picsur_postgres:
image: postgres:14-alpine