@ Action ( name = "Update pg_hba.config" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RETURN_RESULT ) , @ Output ( EXCEPTION ) , @ Output ( STDERR ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . RESOLVED ) , @ Response ( text = ResponseNames . FAILURE , field = RETURN_CODE , value = FAILURE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . ERROR , isOnFail = true ) } ) public Map < String , String > execute ( @ Param ( value = FILE_PATH , required = true ) String installationPath , @ Param ( value = ALLOWED_HOSTS ) String allowedHosts , @ Param ( value = ALLOWED_USERS ) String allowedUsers ) { try { if ( allowedHosts == null && allowedUsers == null ) { return getSuccessResultsMap ( "No changes in pg_hba.conf" ) ; } if ( allowedHosts == null || allowedHosts . trim ( ) . length ( ) == 0 ) { allowedHosts = "localhost" ; } allowedHosts = allowedHosts . replace ( "\'" , "" ) . trim ( ) ; if ( allowedUsers == null || allowedUsers . trim ( ) . length ( ) == 0 ) { allowedUsers = "all" ; } else { allowedUsers = allowedUsers . replace ( "\'" , "" ) . trim ( ) ; } ConfigService . changeProperty ( installationPath , allowedHosts . split ( ";" ) , allowedUsers . split ( ";" ) ) ; return getSuccessResultsMap ( "Updated pg_hba.conf successfully" ) ; } catch ( Exception e ) { return getFailureResultsMap ( "Failed to update pg_hba.conf" , e ) ; } }
Updates the Postgres config pg_hba . config