Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
  • Loading branch information
netroy and ivov authored Oct 20, 2023
1 parent 510284c commit de02993
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/InternalHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class InternalHooks implements IInternalHooksClass {
private roleService: RoleService,
private executionRepository: ExecutionRepository,
eventsService: EventsService,
private instanceSettings: InstanceSettings,
private readonly instanceSettings: InstanceSettings,
) {
eventsService.on('telemetry.onFirstProductionWorkflowSuccess', async (metrics) =>
this.onFirstProductionWorkflowSuccess(metrics),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/License.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class License {

private redisPublisher: RedisServicePubSubPublisher;

constructor(private instanceSettings: InstanceSettings) {
constructor(private readonly instanceSettings: InstanceSettings) {
this.logger = getLogger();
}

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ export class Start extends BaseCommand {
if (flags.tunnel) {
this.log('\nWaiting for tunnel ...');

let tunnelSubdomain = process.env.N8N_TUNNEL_SUBDOMAIN ?? '';
tunnelSubdomain = tunnelSubdomain || this.instanceSettings.tunnelSubdomain || '';
let tunnelSubdomain =
process.env.N8N_TUNNEL_SUBDOMAIN ?? this.instanceSettings.tunnelSubdomain ?? '';

if (!tunnelSubdomain) {
if (tunnelSubdomain === '') {
// When no tunnel subdomain did exist yet create a new random one
const availableCharacters = 'abcdefghijklmnopqrstuvwxyz0123456789';
tunnelSubdomain = Array.from({ length: 24 })
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/posthog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { PublicUser } from '@/Interfaces';
export class PostHogClient {
private postHog?: PostHog;

constructor(private instanceSettings: InstanceSettings) {}
constructor(private readonly instanceSettings: InstanceSettings) {}

async init() {
const enabled = config.getEnv('diagnostics.enabled');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Telemetry {
constructor(
private postHog: PostHogClient,
private license: License,
private instanceSettings: InstanceSettings,
private readonly instanceSettings: InstanceSettings,
) {}

async init() {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Cipher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { InstanceSettings } from './InstanceSettings';

@Service()
export class Cipher {
constructor(private instanceSettings: InstanceSettings) {}
constructor(private readonly instanceSettings: InstanceSettings) {}

encrypt(data: string) {
return AES.encrypt(data, this.instanceSettings.encryptionKey).toString();
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ const getCommonWorkflowFunctions = (

getRestApiUrl: () => additionalData.restApiUrl,
getInstanceBaseUrl: () => additionalData.instanceBaseUrl,
getInstanceId: async () => Container.get(InstanceSettings).instanceId,
getInstanceId: () => Container.get(InstanceSettings).instanceId,
getTimezone: () => getTimezone(workflow, additionalData),

prepareOutputData: async (outputData) => [outputData],
Expand Down Expand Up @@ -2616,7 +2616,7 @@ function isFilePathBlocked(filePath: string): boolean {
//restrict access to .n8n folder and other .env config related paths
if (blockFileAccessToN8nFiles) {
const { n8nFolder } = Container.get(InstanceSettings);
const restrictedPaths: string[] = [n8nFolder];
const restrictedPaths = [n8nFolder];

if (process.env[CONFIG_FILES]) {
restrictedPaths.push(...process.env[CONFIG_FILES].split(','));
Expand Down
2 changes: 1 addition & 1 deletion packages/node-dev/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class Build extends Command {
help: flags.help({ char: 'h' }),
destination: flags.string({
char: 'd',
description: `The path to copy the compiles files to [default: ${
description: `The path to copy the compiled files to [default: ${
Container.get(InstanceSettings).customExtensionDir
}]`,
}),
Expand Down
4 changes: 2 additions & 2 deletions packages/workflow/test/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export interface INodeTypesObject {
}

export class Credentials extends ICredentials {
hasNodeAccess(): boolean {
hasNodeAccess() {
return true;
}

setData(data: ICredentialDataDecryptedObject): void {
setData(data: ICredentialDataDecryptedObject) {
this.data = JSON.stringify(data);
}

Expand Down

0 comments on commit de02993

Please sign in to comment.