@@ -92,29 +92,31 @@ export class EnvironmentVariablesPresenter {
9292 const variables = await repository . getProject ( project . id ) ;
9393
9494 return {
95- environmentVariables : environmentVariables . flatMap ( ( environmentVariable ) => {
96- const variable = variables . find ( ( v ) => v . key === environmentVariable . key ) ;
95+ environmentVariables : environmentVariables
96+ . flatMap ( ( environmentVariable ) => {
97+ const variable = variables . find ( ( v ) => v . key === environmentVariable . key ) ;
9798
98- return sortedEnvironments . flatMap ( ( env ) => {
99- const val = variable ?. values . find ( ( v ) => v . environment . id === env . id ) ;
100- const isSecret =
101- environmentVariable . values . find ( ( v ) => v . environmentId === env . id ) ?. isSecret ?? false ;
99+ return sortedEnvironments . flatMap ( ( env ) => {
100+ const val = variable ?. values . find ( ( v ) => v . environment . id === env . id ) ;
101+ const isSecret =
102+ environmentVariable . values . find ( ( v ) => v . environmentId === env . id ) ?. isSecret ?? false ;
102103
103- if ( ! val ) {
104- return [ ] ;
105- }
104+ if ( ! val ) {
105+ return [ ] ;
106+ }
106107
107- return [
108- {
109- id : environmentVariable . id ,
110- key : environmentVariable . key ,
111- environment : { type : env . type , id : env . id } ,
112- value : isSecret ? "" : val . value ,
113- isSecret,
114- } ,
115- ] ;
116- } ) ;
117- } ) ,
108+ return [
109+ {
110+ id : environmentVariable . id ,
111+ key : environmentVariable . key ,
112+ environment : { type : env . type , id : env . id } ,
113+ value : isSecret ? "" : val . value ,
114+ isSecret,
115+ } ,
116+ ] ;
117+ } ) ;
118+ } )
119+ . sort ( ( a , b ) => a . key . localeCompare ( b . key ) ) ,
118120 environments : sortedEnvironments . map ( ( environment ) => ( {
119121 id : environment . id ,
120122 type : environment . type ,
0 commit comments