Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env tsx
/* eslint-disable max-len */
import path from 'path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import * as fs from 'fs';
Expand All @@ -19,7 +20,7 @@ const argv = yargs(hideBin(process.argv))
},
config: {
description: 'Path to custom git-proxy configuration file.',
default: 'proxy.config.json',
default: path.join(__dirname, 'proxy.config.json'),
required: false,
alias: 'c',
type: 'string',
Expand Down
25 changes: 14 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/config/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from 'fs';
import { join } from 'path';
import { validate as jsonSchemaValidate } from 'jsonschema';

export let configFile: string = join(process.cwd(), 'proxy.config.json');
export let configFile: string = join(__dirname, '../../proxy.config.json');

/**
* Set the config file path.
Expand All @@ -20,7 +20,7 @@ export function setConfigFile(file: string) {
*/
export function validate(configFilePath: string = configFile!): boolean {
const config = JSON.parse(readFileSync(configFilePath, 'utf-8'));
const schemaPath = join(process.cwd(), 'config.schema.json');
const schemaPath = join(__dirname, '../../config.schema.json');
const schema = JSON.parse(readFileSync(schemaPath, 'utf-8'));
jsonSchemaValidate(config, schema, { required: true, throwError: true });
return true;
Expand Down
8 changes: 1 addition & 7 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,7 @@ export const getAPIAuthMethods = (): Authentication[] => {
_apiAuthentication = _userSettings.apiAuthentication;
}

const enabledAuthMethods = _apiAuthentication.filter((auth) => auth.enabled);

if (enabledAuthMethods.length === 0) {
console.log('Warning: No authentication method enabled for API endpoints.');
}

return enabledAuthMethods;
return _apiAuthentication.filter((auth) => auth.enabled);
};

// Log configuration to console
Expand Down
Loading