@@ -710,31 +710,25 @@ func (ncp *NginxConfigParser) apiDetailsFromLocationDirective(
710710 return nil
711711 }
712712
713- isWriteEnabled := false
714- for _ , locChild := range current .Block {
715- if ncp .isPlusAPIWriteEnabled (ctx , locChild , current .Args [0 ]) {
716- isWriteEnabled = true
717- break
718- }
719- }
720-
721713 addresses := ncp .parseAddressFromServerDirective (parent )
722714 path := ncp .parsePathFromLocationDirective (current )
723715
724- params := apiCreationParams {
725- locationDirectiveName : locationDirectiveName ,
726- path : path ,
727- caCertLocation : caCertLocation ,
728- isSSL : isSSL ,
729- isWriteEnabled : isWriteEnabled ,
730- }
731-
732716 for _ , locChild := range current .Block {
733717 if locChild .Directive != plusAPIDirective && locChild .Directive != stubStatusAPIDirective {
734718 continue
735719 }
736720
737721 if locChild .Directive == locationDirectiveName {
722+ isWriteEnabled := ncp .isPlusAPIWriteEnabled (ctx , locChild , current .Args [0 ])
723+
724+ params := apiCreationParams {
725+ locationDirectiveName : locationDirectiveName ,
726+ path : path ,
727+ caCertLocation : caCertLocation ,
728+ isSSL : isSSL ,
729+ isWriteEnabled : isWriteEnabled ,
730+ }
731+
738732 details = append (details , ncp .createAPIDetailsForAddresses (
739733 params ,
740734 addresses ,
0 commit comments