File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { httpAgent } from './http/http-agent.js' ;
2
2
import { config } from '../config.js' ;
3
+ import { logger } from './logger.js' ;
3
4
4
5
const { lcms : lcmsConfig } = config ;
5
6
const getLatestRelease = async function ( ) {
7
+ let signature ;
8
+ // eslint-disable-next-line n/no-process-env
9
+ if ( process . env . APP ) {
10
+ // eslint-disable-next-line n/no-process-env
11
+ signature = `${ process . env . APP } -${ process . env . CONTAINER } @${ process . env . REGION_NAME } ` ;
12
+ } else {
13
+ signature = 'pix-api' ;
14
+ }
15
+
6
16
const response = await httpAgent . get ( {
7
17
url : lcmsConfig . url + '/releases/latest' ,
8
- headers : { Authorization : `Bearer ${ lcmsConfig . apiKey } ` } ,
18
+ headers : { Authorization : `Bearer ${ lcmsConfig . apiKey } ` , Referer : signature } ,
9
19
} ) ;
10
20
11
21
if ( ! response . isSuccessful ) {
12
22
throw new Error ( `An error occurred while fetching ${ lcmsConfig . url } ` ) ;
13
23
}
14
24
25
+ const version = response . data . id ;
26
+ const createdAt = response . data . createdAt ;
27
+ const message = `Release ${ version } created on ${ createdAt } successfully received from LCMS` ;
28
+
29
+ logger . info ( message ) ;
15
30
return response . data . content ;
16
31
} ;
17
32
You can’t perform that action at this time.
0 commit comments