Skip to content

Commit

Permalink
pass token in vercel env ops
Browse files Browse the repository at this point in the history
  • Loading branch information
IamLizu committed Aug 1, 2024
1 parent be05e4d commit f772970
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/utils/VercelManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ class VercelManager {

checkIfEnvExists(key) {
try {
const result = spawn.sync("vercel", ["env", "ls", "production"], {
encoding: "utf-8",
});
const result = spawn.sync(
"vercel",
["env", "ls", "production", "--token", this.vercelToken],
{
encoding: "utf-8",
}
);
if (result.error) {
throw result.error;
}
Expand All @@ -79,10 +83,14 @@ class VercelManager {

addEnvVariable(key, value, env, bar) {
try {
const result = spawn.sync("vercel", ["env", "add", key, env], {
input: value,
stdio: "pipe",
});
const result = spawn.sync(
"vercel",
["env", "add", key, env, "--token", this.vercelToken],
{
input: value,
stdio: "pipe",
}
);
if (result.error) {
throw result.error;
}
Expand All @@ -99,7 +107,15 @@ class VercelManager {
try {
const result = spawn.sync(
"vercel",
["env", "add", key, env, "--force"],
[
"env",
"add",
key,
env,
"--force",
"--token",
this.vercelToken,
],
{ input: value, stdio: "pipe" }
);
if (result.error) {
Expand Down

0 comments on commit f772970

Please sign in to comment.