File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
packages/cli-v3/src/commands Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " trigger.dev " : patch
3
+ ---
4
+
5
+ Add openssl to prod worker image and allow passing auth token via env var for deploy
Original file line number Diff line number Diff line change @@ -72,6 +72,33 @@ export async function login(options?: LoginOptions): Promise<LoginResult> {
72
72
intro ( "Logging in to Trigger.dev" ) ;
73
73
}
74
74
75
+ const accessTokenFromEnv = process . env . TRIGGER_ACCESS_TOKEN ;
76
+
77
+ if ( accessTokenFromEnv ) {
78
+ const auth = {
79
+ accessToken : accessTokenFromEnv ,
80
+ apiUrl : process . env . TRIGGER_API_URL ?? "https://api.trigger.dev" ,
81
+ } ;
82
+ const apiClient = new CliApiClient ( auth . apiUrl , auth . accessToken ) ;
83
+ const userData = await apiClient . whoAmI ( ) ;
84
+
85
+ if ( ! userData . success ) {
86
+ throw new Error ( userData . error ) ;
87
+ }
88
+
89
+ return {
90
+ ok : true as const ,
91
+ profile : options ?. profile ?? "default" ,
92
+ userId : userData . data . userId ,
93
+ email : userData . data . email ,
94
+ dashboardUrl : userData . data . dashboardUrl ,
95
+ auth : {
96
+ accessToken : auth . accessToken ,
97
+ apiUrl : auth . apiUrl ,
98
+ } ,
99
+ } ;
100
+ }
101
+
75
102
const authConfig = readAuthConfigProfile ( options ?. profile ) ;
76
103
77
104
if ( authConfig && authConfig . accessToken ) {
You can’t perform that action at this time.
0 commit comments