Files
supabase/examples/angular-todo-list/set-env.ts
geromegrignon 13533229a9 feat: add Angular todo list example
add Angular todo list source code
add the example to the existing list on supabase.io
add codeowners file for automated assignment fo reviews
2021-07-14 23:20:57 +02:00

24 lines
625 B
TypeScript

import ErrnoException = NodeJS.ErrnoException
const { writeFile } = require('fs')
// Configure Angular `environment.ts` file path
const targetPath = './src/environments/environment.prod.ts'
// read environment variables from .env file
require('dotenv').config()
// `environment.ts` file structure
const envConfigFile = `export const environment = {
production: true,
supabaseUrl: '${process.env.ANGULAR_APP_SUPABASE_URL}',
supabaseKey: '${process.env.ANGULAR_APP_SUPABASE_KEY}'
};
`
writeFile(targetPath, envConfigFile, function (err: ErrnoException | null) {
if (err) {
throw console.error(err)
}
})