The WebAdmin internal component has been included in 4D v18 R6. This component is the foundation of many future administration modules. It’s web-based so that you can use it with headless environments. The first published web-based administration module is the Data Explorer, which we’ve explained thoroughly in this blog post.
Let’s see how to set it up.
A dedicated Web Server
As you certainly learned reading this blog post, 4D allows each component to have its own web server. It’s particularly efficient for splitting application code into several business units. So when we needed to create a new web-based administration environment, we decided to use our own technology!
The Data Explorer uses the WebAdmin component web server so that the settings explained in this blog post also apply to it.
Secured by default
There’s no need to worry when using 4D, your settings and data are not exposed to malicious eyes!
Component access is protected by an access key. If the access key isn’t defined, there’s no way to access the WebAdmin web server (or the Data Explorer) using a browser.
So by default, the only way to use the Data Explorer is to start the web server and open its interface by clicking on the Data Explorer menu item. This way, there’s no need to set an access key because the main security issue, in this case, is located between the computer and the chair!
Allowing accesses using the interface
Starting with 4D v18 R6, you’ll see a new entry in the File menu of 4D and 4D Server: Web Administration. Its first submenu item is Settings, which allows you to display the settings dialog below:
As you can see, the WebAdmin web server is not automatically started by default. If you want it to run automatically at 4D startup, just activate the first checkbox.
You can also set up the available protocols and their publication ports. Just keep in mind that HTTP connections to the WebAdmin are available only for the localhost. If you want to connect from another computer, you must use the HTTPS protocol.
The WebAdmin component embeds its own certificate, but as it’s not defined for your own domain, you may use your own certificate and set the folder containing the corresponding files.
Last but not least, you can set the access key that protects your access to WebAdmin against browsers.
Note that all settings are effective only after the WebAdmin web server restarts.
Allowing accesses using CLI
The CLI (Command Line Interface) is used when you launch 4D or 4D Server in headless mode. Since there’s no way to display the settings interface in headless mode, several new parameters regarding the WebAdmin component have been added to the CLI:
–webadmin-settings-file
This parameter allows you to use another settings file. All settings established in this file will override the current WebAdmin settings.
In the following example, the WebAdmin component will use the settings defined in the “customWA.4DSettings” file when 4D starts:
./4D −−webadmin-settings-file “/Users/John Doe/Documents/customWA.4DSettings” |
–webadmin-access-key
This parameter allows you to set the access key.
In the following example, the WebAdmin component will use the “MicKey” access key when 4D starts:
./4D −−webadmin-access-key “MicKey” |
–webadmin-auto-start
This parameter allows you to start the WebAdmin web server at 4D startup.
In the following example, the WebAdmin component will automatically start its web server when 4D starts:
./4D −−webadmin-auto-start true |
–webadmin-store-settings
This parameter allows you to store the two previous settings in the settings file (the custom settings file if the corresponding parameter is used, else the WebAdmin component settings file). If you don’t use this parameter, the two previous settings are used only for the current 4D execution.
In the following example, when 4D starts, the WebAdmin component will automatically start using the “MicKey” access key and stoe these settings in its own settings file:
./4D −−webadmin-access-key “MicKey” −−webadmin-auto-start true –webadmin-store-settings |
You can see more details about these parameters in the 4D documentation.
Running multiple 4D instances
The settings are shared by all 4D or 4D Server instances. Otherwise, automatically starting the WebAdmin web server would have generated issues. Don’t worry if a publication port is not available when 4D starts the WebAdmin web server, it will try with the following ports.
Reminder
As mentioned in the introduction, the WebAdmin component is the foundation of many features to come. So feel free to tell us what you think in the forum and describe any kind of component you can imagine!