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

Configure ssl ca -- setup ssl_sa for developer #211

Merged
merged 2 commits into from
Dec 11, 2023
Merged
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
12 changes: 11 additions & 1 deletion src/cloud-cli/applications/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import YAML from "yaml";
import { createGlobalLogger } from "../../telemetry/logs";
import { getCloudCredentials } from "../utils";
import { ConfigFile, loadConfigFile, dbosConfigFilePath } from "../../dbos-runtime/config";
import { execSync } from "child_process";

export async function configureApp(host: string, port: string, dbName: string) {
const logger = createGlobalLogger();
Expand Down Expand Up @@ -42,9 +43,18 @@ export async function configureApp(host: string, port: string, dbName: string) {
return;
}

try {
// Should we just download and keep the file in the dir instead of downloading everytime ??
Copy link
Member

@kraftp kraftp Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do an "if file not exists" check here to fix this issue.

Copy link
Contributor Author

@manojdbos manojdbos Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issue if the file exists. We just overwrite it. No big deal. My question was -- should we keep the file in the examples/hello so we never make the rest call ? The downside is that if they change the cert chain , then the file we have might be out of date.

Copy link
Member

@kraftp kraftp Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, I don't think we should keep the file in the repository, downloading it is fine as you said

execSync("wget https://truststore.pki.rds.amazonaws.com/us-east-1/us-east-1-bundle.pem -O us-east-1-bundle.pem")
} catch(e) {
logger.error((e as Error).message);
logger.error("Error downloading RDS certificate bundle. Try downloading it manually from AWS.");
}

// update hostname and port
configFile.database.hostname = userdbHostname
configFile.database.port = userdbPort
configFile.database.ssl_ca = "us-east-1-bundle.pem"

// save the file
try {
Expand All @@ -54,6 +64,6 @@ export async function configureApp(host: string, port: string, dbName: string) {
return;
}

logger.info("Successfully configure user database at ${userdbHostname}:${userdbPort}.")
logger.info(`Successfully configured user database at ${userdbHostname}:${userdbPort}.`)

}
Loading