2
0

🛂 Add backup and restore database scripts

This commit is contained in:
Baptiste Arnaud
2022-11-23 11:40:57 +01:00
parent d80cc1b248
commit 3645607ed4
10 changed files with 107 additions and 43 deletions

27
packages/scripts/utils.ts Normal file
View File

@@ -0,0 +1,27 @@
import { join } from 'path'
import prompts from 'prompts'
import { isEmpty } from 'utils'
export const promptAndSetEnvironment = async () => {
const response = await prompts({
type: 'select',
name: 'env',
message: 'Pick an environment',
choices: [
{
title: 'Local',
value: 'local',
},
{ title: 'Staging', value: 'staging' },
{ title: 'Production', value: 'production' },
],
initial: 0,
})
if (isEmpty(response.env)) process.exit()
require('dotenv').config({
override: true,
path: join(__dirname, `.env.${response.env}`),
})
}