Skip to content

Commit a773f3e

Browse files
committed
feat: add support using an environment variable for the access token
1 parent 958e023 commit a773f3e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/CliConfiguration.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ public function __destruct()
6464
*/
6565
public function getAccessToken(): string
6666
{
67-
return $this->get('token');
67+
$token = getenv('YMIR_API_TOKEN');
68+
69+
if (!is_string($token)) {
70+
$token = $this->get('token');
71+
}
72+
73+
return (string) $token;
6874
}
6975

7076
/**
@@ -84,7 +90,7 @@ public function getActiveTeamId(): int
8490
*/
8591
public function hasAccessToken(): bool
8692
{
87-
return $this->has('token');
93+
return !empty($this->getAccessToken());
8894
}
8995

9096
/**

0 commit comments

Comments
 (0)