Change playwright to always use env vars (#5851)

* Change playwright to always use env vars

* Change to not be so noisy
This commit is contained in:
Jonathan Tran
2025-03-17 20:00:07 -04:00
committed by GitHub
parent ff6186f4f0
commit cb0470a31d

View File

@ -1,8 +1,9 @@
import { readFileSync } from 'fs'
const secrets: Record<string, string> = {}
const secretsPath = './e2e/playwright/playwright-secrets.env'
try {
const file = readFileSync('./e2e/playwright/playwright-secrets.env', 'utf8')
const file = readFileSync(secretsPath, 'utf8')
file
.split('\n')
.filter((line) => line && line.length > 1)
@ -15,9 +16,12 @@ try {
})
} catch (err) {
// probably running in CI
secrets.token = process.env.token || ''
secrets.snapshottoken = process.env.snapshottoken || ''
// add more env vars here to make them available in CI
console.warn(
`Error reading ${secretsPath}; environment variables will be used`
)
}
secrets.token = secrets.token || process.env.token || ''
secrets.snapshottoken = secrets.snapshottoken || process.env.snapshottoken || ''
// add more env vars here to make them available in CI
export { secrets }