Skip to content

Commit

Permalink
Use relative base path respective to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
samirsilwal committed Oct 11, 2024
1 parent 5fa895b commit 0b78470
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ export async function loadConfig(configFilename: string = CONFIG_FILENAME): Prom

validate(loaded);

// Resolve the base path relative to the config file location.
const configFileLocation = filepath.split('/').slice(0, -1).join('/');
const relativeBasePath = path.join(configFileLocation, loaded.basePath);

const result = {
...loaded,
basePath: relativeBasePath,
injectedConfig: {
...loaded.injectedConfig,
vars: prepareInjectionConfigVars(loaded.injectedConfig.vars)
Expand Down
4 changes: 1 addition & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Global Constants */

import * as path from 'path';

import Configuration from './domain/Configuration';

// General constants
Expand All @@ -13,7 +11,7 @@ export const CONNECTIONS_FILENAME = 'connections.sync-db.json';

export const INJECTED_CONFIG_TABLE = '__sync_db_injected_config';
export const DEFAULT_CONFIG: Configuration = {
basePath: path.resolve(process.cwd(), 'src'),
basePath: 'src',
connectionResolver: '',
execution: 'parallel',
sql: [],
Expand Down

0 comments on commit 0b78470

Please sign in to comment.