Output List of message routes - nservicebus

As part of my startup sequence, I am attempting to log the routes that are defined in the configuration. I see (in the debugger) that what I am looking for is exposed in "StaticMessageRouter.routes". Is there any way to get programmatic access to these routes? This would allow me to see (in the log file) which commands/events defined in this service as well as seeing what is in the UnicastBusConfig section in the config file.
Does this make sense? Is there any other way to accomplish the same goal?

Related

How/Where to store sensitive information in .netCore project in Azure DevOps/Local

Shortly my scenario is to test a remote API if there was any changes in the called APIs, like some parameter removed or something like that.
To get this info I need to have a token.
My problem is, I can't store it in the Database and use windowsCredentials, because in the AzurePipeline the build agents has no access and connection to the Database. And if I pass the token through variables in the pipeline then I won't have the token when I run the code in local.
appSetting is stored in Git so it is not safe.
Any idea on this?
Thanks!
UserSecrets + Environment variables are the key here. Appsettings.json is for configuration that is non-sensitive, but there is a concept called user secrets (see link below) that will allow you to have stored an appsettings.json equivalent just on your machine and not in git. When specifying info in it it should override or add onto anything in your appsettings.json.
If that info is also needed for production, then environment variables should be used. Instead of a file, single configurations can be specified/overridden using environment variables.
This is all accomplished ONLY if the aspnet core web server configuration is setup to accept from all of these places. The default setup from the template should accomplish this but read the links below to make sure that your setup works.
All the configuration and best practices can be found here.
Non sensitive info/Defaults: appsettings.json
Sensitive info for devs/dev specific info: UserSecrets
Sensitive info for prod: Environment variables

How To Tell weblogic To Not Log Certain Requests In Its Access Log?

I have all the requests going to access.log in weblogic server, I need to stop logging few request patterns. Is there any possibility ?
I already customized the access loggers with CustomELFLogger and seems to be there is no option to stop the logs not to go to access.log file.
Any other thoughts ?
There is no feature to filter the particular requests but a workaround would be , implement the customelflogger and replace cs-uri filed with custom class.
In the custom class, just put a condition for the specific requests that needs to be filtered and leave the rest.
It is working as expected.

List of served files in apache

I am doing some reverse engineering on a website.
We are using LAMP stack under CENTOS 5, without any commercial/open source framework (symfony, laravel, etc). Just plain PHP with an in-house framework.
I wonder if there is any way to know which files in the server have been used to produce a request.
For example, let's say I am requesting http://myserver.com/index.php.
Let's assume that 'index.php' calls other PHP scripts (e.g. to connect to the database and retrieve some info), it also includes a couple of other html files, etc
How can I get the list of those accessed files?
I already tried to enable the server-status directive in apache, and although it is working I can't get what I want (I also passed the 'refresh' parameter)
I also used lsof -c httpd, as suggested in other forums, but it is producing a very big output and I can't find what I'm looking for.
I also read the apache logs, but I am only getting the requests that the server handled.
Some other users suggested to add the PHP directives like 'self', but that means I need to know which files I need to modify to include that directive beforehand (which I don't) and which is precisely what I am trying to find out.
Is that actually possible to trace the internal activity of the server and get those file names and locations?
Regards.
Not that I tried this, but it looks like mod_log_config is the answer to my own question

How to access the moqui web application running on one system from other system

I have moqui running on system1 which is accessible using URL http://localhost:8080/Login.
Trying to access it from other system2 (in network) with URL replacing 'localhost' with the IP of first system; it shows the first (log-in) page, but afterwards, when submitting the pages from system2, the IP in URL automatically gets changed to 'localhost'. I have looked in to the book and also searched in framework code but couldn't find something related to this.
What could be the cause of this, is there any setting in app to fix this?
There are two parts to configuring hosts and ports for a webapp. One is is for the servlet container so it knows what to listen to and the other is in Moqui Framework itself so it knows what to use when generating URLs. It sounds like the issue you are having is with the second, with URL generation.
In your runtime Moqui XML Conf file there should be a webapp element somewhat like this one from the MoquiProductionConf.xml file:
<webapp name="webroot" http-port="" http-host=""
https-port="" https-host="" https-enabled="false"
content-prefix-secure="" content-prefix-standard="" cookie-domain="">
<root-screen host=".*" location="component://webroot/screen/webroot.xml"/>
</webapp>
When no #http-host/etc attribute is specified the values from the HttpServletRequest object will be used. These will vary depending on the settings of the servlet container you are using to deploy Moqui Framework.
To set it to something explicit you can use the http-host and if needed the https-host, http-port, and https-port attributes. For virtual host support the http-host and https-host attributes should be empty and the servlet container (and any proxy/etc in front of it) should be configured to pass through the hostname requested.

Include YII Application in a script

I would like to create a PHP script which is called via CLI. And I would like that script to have access to the Yii application. Therefore I created a file called (script.php)
// file: script.php
ob_start();
include "index.php"
ob_clean();
echo "This is my script !";
I had to include the *ob_start* and *ob_clean* as if I didn't the layout of the application was being render.
Is this the right way to do this? Or should I be doing something else?
If you want to deal with php console, it is highly recommended to use CConsoleCommand. You can create your file which must act in console in protected/commands path. So your class would be something like below:
class TestConsoleCommand extends CConsoleCommand{}
You can implement your php codes into your functions, but note that the most important method in your class would be init() method. Once your consoleCommand runs, this method will be called.
another important note is that, THE CONFIG OF CONSOLE COMMAND IS DIFFERENT WITH NON-CONSOLE. It means that while your ordinary Yii application is running, you are using main.php config file, which is situated in protected/config/main.php. In order to access your models and database config ... in your Yii ConsoleApp, You must fulfill the console.php config file which is situated in protected/config/console.php.
You can configure your database connection in this file, which you want to access it, while your ConsoleApp is running. You can also import all your classes you need to interact.
Some useful links and documents:
CConsoleCommand - represents an executable console command
The Definitive Guide to Yii - Console Applications
I hope it helps :)