Skip to content

Commit

Permalink
Merge pull request #407 from elsoul/doc
Browse files Browse the repository at this point in the history
update skeet doc setup ja
  • Loading branch information
POPPIN-FUMI authored Apr 15, 2024
2 parents e19e5d8 + 4b61902 commit 63000de
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 143 deletions.
7 changes: 7 additions & 0 deletions .changeset/red-owls-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"skeet-doc": patch
"@skeet-framework/cli": patch
"@skeet-framework/ai": patch
---

Update - skeet doc setup
7 changes: 0 additions & 7 deletions packages/ai/src/lib/openAIChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ export const openAIChat = async (
contents: Array<ChatCompletionMessageParam>,
config = defaultOpenAIConfig,
) => {
if (config.organizationKey === '' || config.apiKey === '') {
console.error(
'CHAT_GPT_ORG and CHAT_GPT_KEY are required in .env file.\n\nor you can pass them as arguments to the function.',
)
process.exit(1)
}

const ai = new OpenAI({
apiKey,
organization: organizationKey,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cli/get/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const listSubCommands = () => {
.action(async () => {
const { app } = await readOrCreateConfig()
const res = await getZone(app.projectId, app.name)
Logger.dnsSetupLog(res)
Logger.dnsSetupLog(res, '<your-load-balancer-ip>')
})
get
.command('secret')
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/cli/init/initLb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export const initLb = async () => {
)
await firebaseFunctionsDeploy(skeetConfig.app.projectId)

await setupLoadBalancer(
const lbIp = await setupLoadBalancer(
skeetConfig,
domainInquirer.lbDomain,
domainInquirer.nsDomain,
)
await initArmor()
await syncArmors()
const ips = await getZone(skeetConfig.app.projectId, skeetConfig.app.name)
Logger.dnsSetupLog(ips)
Logger.dnsSetupLog(ips, lbIp)
}

const requireDomainName = (value: string) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/lib/gcloud/network/createLoadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const createLoadBalancer = async () => {
domainAnswer.lbDomain,
DEFAULT_FUNCTION_NAME,
)
await setupLoadBalancer(
const lbIp = await setupLoadBalancer(
skeetConfig,
domainAnswer.lbDomain,
domainAnswer.nsDomain,
Expand All @@ -32,7 +32,7 @@ export const createLoadBalancer = async () => {
await setupArmor(skeetConfig.app.projectId, skeetConfig.app.name)
await updateArmorCloudConifg()
const ips = await getZone(skeetConfig.app.projectId, skeetConfig.app.name)
Logger.dnsSetupLog(ips)
Logger.dnsSetupLog(ips, lbIp)
return true
} catch (error) {
throw new Error(`createLoadBalancer error: ${error}`)
Expand Down
19 changes: 17 additions & 2 deletions packages/cli/src/lib/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ View Emulator UI at : ${chalk.underline('http://127.0.0.1:4000/')}`
}
}

export const dnsSetupLog = (nameServerAddresses: Array<string>) => {
export const dnsSetupLog = (
nameServerAddresses: Array<string>,
lbIp: string,
) => {
Logger.warning(
'🚸 === Copy & Paste below nameServer addresses to your DNS Setting === 🚸\n',
)
Expand All @@ -156,7 +159,19 @@ View Emulator UI at : ${chalk.underline('http://127.0.0.1:4000/')}`
Logger.warning(
'👷 === https will be ready in about an hour after your DNS settings === 👷\n',
)
Logger.successCheck(`You are all set`)
const content = `If you are not utilizing Google DNS, it is necessary to manually configure the A and CAA records.
Please set up the three records listed below:
DNS Records Setup:
--------------------------------
1. A Record:
Address: ${lbIp}
2. CAA Records:
- 0 issue "pki.goog"
- 0 issue "letsencrypt.org"`
Logger.normal(content)
Logger.successCheck(`\nYou are all set`)
Logger.normal(`\n📗 Doc: https://skeet.dev`)
}

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/setup/setupLoadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const setupLoadBalancer = async (

spinner.stop(true)
console.log(chalk.green('⚖️ Load balancer setup completed successfully!\n'))
return ip
} catch (error) {
spinner.stop(true)
Logger.error(`setupLoadBalancer error: ${JSON.stringify(error)}`)
Expand Down
Loading

0 comments on commit 63000de

Please sign in to comment.