mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
support process.env.USE_LINKED_SHARED
This commit is contained in:
parent
47b7c51689
commit
6d274522fd
@ -1,4 +1,3 @@
|
||||
|
||||
import { webcrypto as crypto } from "crypto"
|
||||
import path from "path"
|
||||
import { registerBaseAliases } from "linebridge/dist/server"
|
||||
@ -18,6 +17,11 @@ const customAliases = {
|
||||
|
||||
if (!global.isProduction) {
|
||||
customAliases["comty.js"] = path.resolve(__dirname, "../../comty.js/src")
|
||||
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
if (process.env.USE_LINKED_SHARED) {
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
@ -69,7 +73,9 @@ async function main() {
|
||||
|
||||
// inject to process.env
|
||||
secrets.forEach((secret) => {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
if (!(secret.secretName in process.env)) {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -82,6 +88,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
@ -90,6 +97,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { webcrypto as crypto } from "crypto"
|
||||
import path from "path"
|
||||
import { registerBaseAliases } from "linebridge/dist/server"
|
||||
@ -18,6 +17,11 @@ const customAliases = {
|
||||
|
||||
if (!global.isProduction) {
|
||||
customAliases["comty.js"] = path.resolve(__dirname, "../../comty.js/src")
|
||||
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
if (process.env.USE_LINKED_SHARED) {
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
@ -69,7 +73,9 @@ async function main() {
|
||||
|
||||
// inject to process.env
|
||||
secrets.forEach((secret) => {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
if (!(secret.secretName in process.env)) {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -82,6 +88,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
@ -90,6 +97,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { webcrypto as crypto } from "crypto"
|
||||
import path from "path"
|
||||
import { registerBaseAliases } from "linebridge/dist/server"
|
||||
@ -18,6 +17,11 @@ const customAliases = {
|
||||
|
||||
if (!global.isProduction) {
|
||||
customAliases["comty.js"] = path.resolve(__dirname, "../../comty.js/src")
|
||||
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
if (process.env.USE_LINKED_SHARED) {
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
@ -69,7 +73,9 @@ async function main() {
|
||||
|
||||
// inject to process.env
|
||||
secrets.forEach((secret) => {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
if (!(secret.secretName in process.env)) {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -82,6 +88,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
@ -90,6 +97,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
|
@ -17,6 +17,11 @@ const customAliases = {
|
||||
|
||||
if (!global.isProduction) {
|
||||
customAliases["comty.js"] = path.resolve(__dirname, "../../comty.js/src")
|
||||
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
if (process.env.USE_LINKED_SHARED) {
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
@ -60,16 +65,12 @@ import API from "./api"
|
||||
|
||||
async function main() {
|
||||
if (process.env.INFISICAL_TOKEN) {
|
||||
console.log("🔑 Fetching secrets from Infisical...")
|
||||
|
||||
const client = new infisical({
|
||||
token: process.env.INFISICAL_TOKEN,
|
||||
})
|
||||
|
||||
const secrets = await client.getAllSecrets()
|
||||
|
||||
console.log("🔑 Injecting secrets to process.env...",)
|
||||
|
||||
// inject to process.env
|
||||
secrets.forEach((secret) => {
|
||||
if (!(secret.secretName in process.env)) {
|
||||
@ -78,13 +79,6 @@ async function main() {
|
||||
})
|
||||
}
|
||||
|
||||
// transform "undefined" or "null" envs to undefined
|
||||
Object.keys(process.env).forEach((key) => {
|
||||
if (process.env[key] === "undefined" || process.env[key] === "null") {
|
||||
process.env[key] = undefined
|
||||
}
|
||||
})
|
||||
|
||||
const instance = new API()
|
||||
|
||||
await instance.initialize()
|
||||
@ -94,6 +88,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
@ -102,6 +97,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { webcrypto as crypto } from "crypto"
|
||||
import path from "path"
|
||||
import { registerBaseAliases } from "linebridge/dist/server"
|
||||
@ -18,6 +17,11 @@ const customAliases = {
|
||||
|
||||
if (!global.isProduction) {
|
||||
customAliases["comty.js"] = path.resolve(__dirname, "../../comty.js/src")
|
||||
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
if (process.env.USE_LINKED_SHARED) {
|
||||
customAliases["@shared-classes"] = path.resolve(__dirname, "shared-classes")
|
||||
}
|
||||
|
||||
@ -69,7 +73,9 @@ async function main() {
|
||||
|
||||
// inject to process.env
|
||||
secrets.forEach((secret) => {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
if (!(secret.secretName in process.env)) {
|
||||
process.env[secret.secretName] = secret.secretValue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -82,6 +88,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
@ -90,6 +97,7 @@ async function main() {
|
||||
if (typeof instance.server.close === "function") {
|
||||
instance.server.close()
|
||||
}
|
||||
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user