-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add aws region to config, add 'config' command
- Loading branch information
Showing
12 changed files
with
94 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { getConfiguration } from "../configuration"; | ||
|
||
export async function config() { | ||
const configuration = await getConfiguration(); | ||
return configuration; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
// TODO wip | ||
// { | ||
// aws: { | ||
// region: configuration("string") | ||
// .optional() | ||
// .default(null) | ||
// .fromConfigFile("aws/region") | ||
// .fromParam("awsRegion"); | ||
// } | ||
// } | ||
import fs from "fs/promises"; | ||
|
||
interface AwsConfig { | ||
region: string | undefined; | ||
} | ||
|
||
export async function getConfiguration() { | ||
// For now, box config is hard coded to the current location. | ||
const boxConfigPath = "./boxes.json"; | ||
const data = await fs.readFile(boxConfigPath, "utf8"); | ||
const json = JSON.parse(data); | ||
|
||
// If we have an aws key and a region key, set it. | ||
const awsRegion = json["aws"]?.["region"]; | ||
const awsConfig: AwsConfig = { | ||
...(awsRegion && { region: awsRegion }), | ||
}; | ||
|
||
return { | ||
...json, | ||
aws: awsConfig, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters