Hi Pubudu, Ack, let me try as suggested above Thank you, Nadeesha
On Wed, Nov 28, 2018 at 6:10 PM Pubudu Fernando <[email protected]> wrote: > Hi Nadeesha and all, > > I had a closer a look at this, using the demo API provided (Pizzashack > API) in APIM. In Ubuntu, this worked fine and the provided config was set > as expected. However, in Windows, there seems to be an issue in the > gateway.bat script [1]. Got the following error in addition to the usual > startup logs: > .\runtime\bin\ballerina : ballerina: HTTP access log enabled > At line:1 char:1 > + .\runtime\bin\ballerina run .\exec\pizzashack-project.balx -e api ... > + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + CategoryInfo : NotSpecified: (ballerina: HTTP access log > enabled:String) [], RemoteException > + FullyQualifiedErrorId : NativeCommandError > > The above error didn't stop the services from starting up. And as you > mentioned, the config wasn't overridden. > > However, you can directly run the program without any problems. I ran the > following from GW_HOME: > >runtime\bin\ballerina run --config conf\micro-gw.conf -e > PizzaShackAPI.1.0.0.prod.endpoint.0="http://localhost:8080/xxxxx" > exec\pizzashack-project.balx > > In this case, there weren't any errors. And when trying to invoke the API, > it resulted in a 500 Internal Server Error response (which is expected in > this case I guess) and in the gateway console, the following was logged for > the request which confirms that the config for the endpoint URL was > overridden using the one we provided using the -e flag: > > 2018-11-28 17:44:04,895 ERROR [src:0.0.0] - Error in client response : > {message:"Connection refused: no further information: localhost/ > 127.0.0.1:8080", cause:null} > > Also note that setting the above endpoint URL as an env var works since in > that case, the config API will simply look it up in env vars (tested for > the above case). The periods in the config key has to be replaced by > underscores as Rajith pointed out. However, don't put the URL within quotes > when setting the env var. That'll cause an error in parsing the URL when > trying to initialize the HTTP endpoint. > > [1] > https://github.com/wso2/product-microgateway/blob/master/components/micro-gateway-cli/src/main/resources/distribution/bin/gateway.bat > > Regards, > Pubudu > > On Tue, Nov 27, 2018 at 10:07 AM Nadeesha Gamage <[email protected]> > wrote: > >> Hi all, >> Can we check and verify this, this looks like a bug to me. >> >> Nadeesha >> >> On Fri, Nov 23, 2018 at 7:13 PM Pubudu Fernando <[email protected]> wrote: >> >>> Hi All, >>> >>> I had a quick look. The following simple b7a program works. Which means >>> this is not an issue with the b7a config API. >>> import ballerina/config; >>> import ballerina/io; >>> >>> public function main() { >>> string s = >>> config:getAsString("InventoryAPI.1.0.prod.endpoint.0"); >>> io:println(s); >>> } >>> >>> $ ballerina run -e InventoryAPI.1.0.prod.endpoint.0=" >>> http://localhost:8080/xxxxx" test.bal >>> >>> Running the above command prints the provided URL on the console. >>> >>> Could it be an issue with the gateway startup script? Shall we verify >>> that the arguments are correctly passed to the ballerina run command? >>> >>> Regards, >>> Pubudu >>> >>> On Tue, Nov 20, 2018 at 5:13 PM Chamila Adhikarinayake < >>> [email protected]> wrote: >>> >>>> Since microgateway uses ballerina config to resolve the variables[1] >>>> related to endpoints, defining environment variables as mentioned in the >>>> ballerina docs should work >>>> >>>> [1] >>>> https://github.com/wso2/product-microgateway/blob/master/components/micro-gateway-core/src/main/ballerina/gateway/utils/utils.bal#L401 >>>> >>>> On Mon, Nov 19, 2018 at 10:19 PM Pubudu Gunatilaka <[email protected]> >>>> wrote: >>>> >>>>> Hi Nadeesha, >>>>> >>>>> Looks like in Windows you have to export env values as follows [1]. >>>>> >>>>> // In Linux and Mac. >>>>> $ export b7a_http_tracelog_path=”./trace.log” >>>>> $ export b7a_http_accesslog_path=”./access.log” // >>>>> >>>>> In Windows. >>>>> $ set(x) b7a_http_tracelog_path=”./trace.log” >>>>> $ set(x) b7a_http_accesslog_path=”./access.log” >>>>> >>>>> Could you please try that? If it works we can add to the >>>>> documentation. @[email protected] <[email protected]> @Shani >>>>> Ranasinghe <[email protected]> @Mariangela Hills <[email protected]> >>>>> >>>>> In addition to this, CLI parameters should work in Windows as well. @Isuru >>>>> Haththotuwa <[email protected]> @Chamila Adhikarinayake >>>>> <[email protected]> : Thoughts? >>>>> >>>>> [1] - https://ballerina.io/learn/api-docs/ballerina/config.html >>>>> >>>>> Thank you! >>>>> >>>>> On Mon, Nov 19, 2018 at 7:16 PM Nadeesha Gamage <[email protected]> >>>>> wrote: >>>>> >>>>>> Hi Rajitha, >>>>>> Setting the environment explicitly doesnt work as well for a Windows >>>>>> environment. >>>>>> >>>>>> Nadeesha >>>>>> >>>>>> On Mon, Nov 19, 2018 at 6:29 AM Nadeesha Gamage <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Hi Roshan, >>>>>>> I will try that >>>>>>> >>>>>>> Thank you, >>>>>>> Nadeesha >>>>>>> >>>>>>> On Mon, Nov 19, 2018 at 6:12 AM Rajith Roshan <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> Hi Nadeesha, >>>>>>>> May be an issue reading -e CLI parameters from ballerina config >>>>>>>> API. Can you try setting the environment variable explicitly[1] as >>>>>>>> well. >>>>>>>> >>>>>>>> [1] - export InventoryAPI_1_0_prod_endpoint_0=" >>>>>>>> http://localhost:8080/xxxxx" >>>>>>>> >>>>>>>> Thanks! >>>>>>>> Rajith >>>>>>>> >>>>>>>> On Mon, Nov 19, 2018 at 8:22 AM Nadeesha Gamage <[email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> >>>>>>>>> + API M team >>>>>>>>> >>>>>>>>> ---------- Forwarded message --------- >>>>>>>>> From: Nadeesha Gamage <[email protected]> >>>>>>>>> Date: Sun, Nov 18, 2018 at 11:16 AM >>>>>>>>> Subject: [API M] Overridding endpoint information doesnt work as >>>>>>>>> expected in API Micro Gateway 2.6 >>>>>>>>> To: dev <[email protected]> >>>>>>>>> >>>>>>>>> >>>>>>>>> Hi Devs, >>>>>>>>> I am trying to override an existing backend API endpoint exposed >>>>>>>>> via MG (after building the MG). I am executing the the following >>>>>>>>> command to >>>>>>>>> run the MG but it still goes to the old endpoint. I have attached the >>>>>>>>> source .bal file generated in setup. The command that I executed is >>>>>>>>> also >>>>>>>>> given below >>>>>>>>> >>>>>>>>> gateway -e InventoryAPI.1.0.prod.endpoint.0=" >>>>>>>>> http://localhost:8080/xxxxx" >>>>>>>>> >>>>>>>>> I am running this on a Windows environment. >>>>>>>>> >>>>>>>>> Can anyone let me know if I am doing something wrong or is this an >>>>>>>>> issue? >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Nadeesha Gamage >>>>>>>>> Senior Lead Solutions Engineer >>>>>>>>> T : +94 77 394 5706 >>>>>>>>> B : https://nadeesha678.wordpress.com/ >>>>>>>>> -- >>>>>>>>> Nadeesha Gamage >>>>>>>>> Senior Lead Solutions Engineer >>>>>>>>> T : +94 77 394 5706 >>>>>>>>> B : https://nadeesha678.wordpress.com/ >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Rajith Roshan >>>>>>>> Senior Software Engineer, WSO2 Inc. >>>>>>>> Mobile: +94-7 <%2B94-71-554-8430>17-064-214 >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Nadeesha Gamage >>>>>>> Senior Lead Solutions Engineer >>>>>>> T : +94 77 394 5706 >>>>>>> B : https://nadeesha678.wordpress.com/ >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Nadeesha Gamage >>>>>> Senior Lead Solutions Engineer >>>>>> T : +94 77 394 5706 >>>>>> B : https://nadeesha678.wordpress.com/ >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Pubudu Gunatilaka* >>>>> Committer and PMC Member - Apache Stratos >>>>> Associate Technical Lead >>>>> WSO2, Inc.: http://wso2.com >>>>> mobile : +94774078049 <%2B94772207163> >>>>> >>>>> >>>> >>>> -- >>>> Regards, >>>> Chamila Adhikarinayake >>>> Associate Technical Lead >>>> WSO2, Inc. >>>> Mobile - +94712346437 >>>> Email - [email protected] >>>> Blog - http://helpfromadhi.blogspot.com/ >>>> >>> >>> >>> -- >>> *Pubudu Fernando *| Senior Software Engineer | WSO2 Inc. >>> (m) +94 77 888 2543 | (e) [email protected] >>> >>> >>> >> >> -- >> Nadeesha Gamage >> Senior Lead Solutions Engineer >> T : +94 77 394 5706 >> B : https://nadeesha678.wordpress.com/ >> > > > -- > *Pubudu Fernando *| Senior Software Engineer | WSO2 Inc. > (m) +94 77 888 2543 | (e) [email protected] > > > -- Nadeesha Gamage Senior Lead Solutions Engineer T : +94 77 394 5706 B : https://nadeesha678.wordpress.com/
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
