Downloading and customizing configuration snippets from the command line

You can use the configUtility command to download configuration snippets from the Liberty Repository. You can also use the command to replace configuration snippet variables with your input values. The Liberty Repository config snippets are samples of Liberty server configurations for specific tasks.

Procedure

  1. Open a command line, then change directory to the wlp/bin directory.
  2. Generate a list of configuration snippets in the Liberty Repository.

    Run the following command to write a list of configuration snippets to your console screen:

    configUtility find

    From this generated list, you can determine the name of a configuration snippet to download and, optionally, modify.

    You can specify a string to filter the list to configuration snippets that have the specified string in the description. For example, for a list of security-related configuration snippets, run:
    configUtility find security
    Enclose strings that contain spaces in double-quotations marks; for example:
    configUtility find "ejb security"
  3. Optional: Generate a list of all variable options for a configuration snippet.
    Using the name of configuration snippet obtained in step 2, run the following command to write a list of variable options for the snippet to your console screen. For configSnippet, specify the name of the snippet:
    configUtility install configSnippet --info

    The command returns an empty list if the configuration snippet has no variables for substitution.

  4. Download a configuration snippet.
    Using the name of the configuration snippet obtained in step 2, run the following command to write the configuration snippet to your console screen. For configSnippet, specify the name of the snippet:
    configUtility install configSnippet

    To write the configuration snippet to a file instead of to your console screen, add the --createConfigFile option and specify a file path. You can include the generated file in a server.xml configuration file using an include statement. For example, to write the configuration snippet to the C:\wlp\usr\servers\server1\snippet-include.xml file on your local file system, run the following command:

    configUtility install configSnippet --createConfigFile=C:/wlp/usr/servers/server1/snippet-include.xml
    Tip: If the file path has spaces, you must enclose it in double quotation marks ("). For example, if the file path is C:\Program Files\mySnipets\snippet-include.xml, specify --createConfigFile="C:/Program Files/mySnipets/snippet-include.xml" in the command.
    To download and replace configuration snippet variables found by the --info option with your input values, use the --v[variable]=value option:
    configUtility install configSnippet --vvariable=value
    For example, to specify a value of user1 for the $[adminUser] variable in the remoteAdministration snippet, run:
    configUtility install remoteAdministration --vadminUser=user1
    This command writes a configuration for Remote Administration to a console screen, with user1 replacing the $[adminUser] variable:
    <quickStartSecurity userName="user1" userPassword="${adminPassword}"/>

    For more information about command options, see configUtility command.