Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

remove fly_deploy_with_env script

Blue Mousefda1f37ce3dd
diff --git a/fly_deploy_with_env.js b/fly_deploy_with_env.js
deleted file mode 100644
index 4606fbef8..000000000
--- a/fly_deploy_with_env.js
+++ /dev/null
@@ -1,67 +0,0 @@
-const fs = require('fs')
-const { execSync } = require('child_process')
-
-const args = process.argv.slice(2)
-
-function parseArgs(args) {
- const parsedArgs = {}
- let i = 0
- while (i < args.length) {
- const arg = args[i]
- if (arg.startsWith('--')) {
- const key = arg.slice(2)
- const value = args[i + 1]
- parsedArgs[key] = value
- i += 2
- } else {
- i += 1
- }
- }
- return parsedArgs
-}
-
-function getSecretsFromEnvFile(envFile) {
- const kvPairs = {}
-
- const fileContents = fs.readFileSync(envFile, 'utf8')
- const lines = fileContents.split('\n')
- for (const line of lines) {
- const trimmedLine = line.trim()
- if (!trimmedLine || trimmedLine.startsWith('#')) {
- continue
- }
- const [key, value] = trimmedLine.split('=', 2)
- if (!value) {
- continue
- }
- const strippedValue = value.replace(/["']/g, '')
- kvPairs[key] = strippedValue
- }
-
- return kvPairs
-}
-
-function flyDeploy(secrets) {
- const buildSecrets = []
- for (const [key, value] of Object.entries(secrets)) {
- buildSecrets.push(`--build-secret=${key}=${value}`)
- console.log(`Set .env variable ${key}`)
- }
-
- // Removing first 2 args: --env-file and the .env file path
- args.splice(0, 2)
-
- const command = [
- 'flyctl',
- 'deploy',
- ...args,
- ...buildSecrets,
- ]
-
- console.log(`Running command: ${command.join(' ')}`)
- execSync(command.join(' '), { stdio: 'inherit' })
-}
-
-const parsedArgs = parseArgs(args)
-const envValues = getSecretsFromEnvFile(parsedArgs['env-file'])
-flyDeploy(envValues)
diff --git a/package.json b/package.json
index 8c36804db..d787b335e 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"scripts": {
"build": "remix build",
"dev": "remix dev",
- "deploy": "node fly_deploy_with_env.js --env-file .env --remote-only",
+ "deploy": "flyctl deploy --remote-only",
"import-env": "node fly_import_env.js --env-file .env",
"dev:staging": "cross-env STAGING=true remix dev",
"start": "remix-serve build",