Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Making 'configPath' optional in interfaces #418

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
4 changes: 2 additions & 2 deletions API.md

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

10 changes: 6 additions & 4 deletions src/config/configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export interface GetTagsProps {
/**
* Relative path to config file. Defaults to './ddk.json'
*/
readonly configPath: string;
readonly configPath?: string;
/**
* Environment identifier
*/
Expand All @@ -220,7 +220,7 @@ export interface GetEnvironmentProps {
/**
* Relative path to config file. Defaults to './ddk.json'
*/
readonly configPath: string;
readonly configPath?: string;
/**
* Environment identifier.
*/
Expand All @@ -239,7 +239,8 @@ export class Configurator {
}

public static getTags(props: GetTagsProps): { [key: string]: string } {
const config = getConfig({ config: props.configPath });
const configPath = props.configPath ?? "./ddk.json";
const config = getConfig({ config: configPath });

if (!config || !config.environments) {
throw TypeError("Config not defined.");
Expand All @@ -257,7 +258,8 @@ export class Configurator {
}

public static getEnvironment(props: GetEnvironmentProps): cdk.Environment {
const config = getConfig({ config: props.configPath });
const configPath = props.configPath ?? "./ddk.json";
const config = getConfig({ config: configPath });

if (!config) {
throw TypeError("Config not defined.");
Expand Down