P6 Cmd (p6cmd) is a small utility that is designed for the Platform 6 users and support engineers
to perform a variety of tasks.
For example:
- It can be installed on-premise by Platform 6 customers and allows the submission of file(s) to their instances using on-site scripts or ‘file drop’ folder monitoring.
- It can be installed by Platform 6 Implementation Engineers giving CLI to P6 application lifecycle functionality on any instance.
The latest release of P6 Cmd can be downloaded from here:
Warning
SSO authentication is not available for this application. If you haven’t already, you are required to define a password by editing your profile
P6 Cmd icon¶
The ‘6’ icon in the notification area of your Task bar (on Windows) or in your Menu bar (on Mac) provides quick access links
- “Login…” leads to a login page where you shall initially enter your platform6 credentials
-
“Show status” leads to a page displaying four areas:
- Status - provides statuses regarding Internet connectivity and login
- Login - leads you to the login page (it is greyed when already logged in)
- Log Files - allows you to display P6 Sync log and error logs
- Quit - well… speaks for itself!
-
“Open P6 Portal…” leads you to the Portal
- “Logout” removes stored credentials and forces a new user login
- “Quit P6 Cmd”
Note
The task bar icon is only visible when p6cmd is started in ‘interactive mode’. i.e. Is being used via the browser interface
The browser interface¶
The browser interface is started automatically after first installation. Once a user has logged in (to access their P6 instances), it is no longer required that P6 Cmd should continue running in this mode. Feel free to quit the browser UI once login is complete.
Note
Authentication credential provision can be scripted allowing use via automation pipelines (see later)
Using the Command Line Interface (CLI)¶
Once you have logged in, the CLI can be used to interact with your P6 instance(s).
The CLI is designed for use from batch files or shell script, executed by schedulers or run as a service on Windows
To enable CLI access, the p6cmd install folder must be on your PATH.
Warning
On macOS you have to manually add the following you your .bashrc/.profile file:
export PATH="/Applications/P6 Cmd.app/Contents/MacOS:$PATH"
On Windows the user who installs P6 Cmd will automatically have p6cmd added to their PATH. Other users of Windows must extend their on PATH as follows
PATH="C:\Program Files (x86)\Platform6\p6cmd;%PATH%"
Once on the PATH you can invoke the CLI to get help:
$ p6cmd -help
p6cmd --help
P6 Cmd (p6cmd) is a small utility that is designed for the Platform 6 users and support engineers to perform a variety of tasks.
Usage:
p6cmd [command]
Available Commands:
app Manage Platform 6 applications
completion Generate the autocompletion script for the specified shell
config Manage configuration
help Help about any command
instance Manage instances
keygen Generate a key pair suitable for App Profile generation
monitor Enable folder monitoring for each targeted instance that supports message submission
secret Manage Platform 6 Secrets
server Run p6cmd in interactive mode
submit Send files to each targeted instance that supports message submission
table Manage tables
upgrade Manage p6core upgrade
user Manage users
version Display p6cmd version
Flags:
--console Enable console logging
--debug Enable debug level logging
--env string Environment (dev or staging or prod) (default "prod")
--headless Running without a desktop UI
-h, --help help for p6cmd
--home string Enable console logging (default "c:\\platform6")
--ignore-tls-errors Ignore TLS/SSL related errors
--instance arrayFlags [Optional and can repeat] Instance names to target (default [])
--json Request output format of JSON (where supported)
--no-proxy Bypass the Platform6 Proxy
--port int Web server localhost listen port, 0 = auto assigned
--proxy-override string Platform6 Proxy override
--timeout int Client timeout of requests (default 30)
-t, --toggle Help message for toggle
Use "p6cmd [command] --help" for more information about a command.
You can inspect the version of p6cmd installed in your system :
$ p6cmd version
p6cmd version : 1.2.0
Go version : go1.24.1
UTC Build Date : 2025-05-14_07:57:17AM
OS/Arch : linux/amd64
Git Commit : a24fe4a
Warning
If you run the p6cmd version
command and you see the interactive mode, you are using an out-to-date version of p6cmd. Install the latest version.
To use p6cmd in each environment, you need to run the p6cmd server --env <env>
command and authenticate in the login portal:
$ p6cmd server --env dev
____ __ ____ __ __ ____
| _ \ / /_ / ___| | \/ | | _ \
| |_) | | '_ \ | | | |\/| | | | | |
| __/ | (_) | | |___ | | | | | |_| |
|_| \___/ \____| |_| |_| |____/
Version : 1.2.0
Build date : 2025-05-14_07:57:17AM
Commit ID : a24fe4a
*** Started in interactive configuration mode. You must quit this mode before using the P6 Cmd CLI ***
✔ You are already logged in as user ilangovane.ragavanandane@sidetrade.com
2025/05/16 15:18:13 INFO <p6/restclient.go:325> No http proxy enabled.
2025/05/16 15:18:14 INFO <p6/daemon.go:408> --- p6cmd started ---
Configuring defaults¶
The browser UI provides access to a ‘configuration’ screen where a user can configure a number of defaults to save having to re-type them each time on the command line.
Usage: Message Submission¶
Message Submission is a process of sending one or more files to a Platform 6 instance and triggering a script to process those files. Success or failure results are returned to the message submitter as submission acknowledgement
Message Submission without a user interface (or Portal) is regarded as a more efficient method of regularly transferring files from on-premise folders to a Platform 6 instance for processing and is much easier to automate and integrate into existing on-premise batch processing activities
Platform 6 Message Submission is by its nature flexible and configurable allowing it to fit many project requirements. For example, it has successfully been deployed to a large international supplier community allowing the bulk and regular submission of invoices
Folder usage¶
During execution, P6 Cmd may automatically create a folder structure on your computer, with a parent folder named “platform6”
On Windows, the “platform6” folder is created on C: in the root (“/”) folder
On OS X, the “platform6” folder is under your user folder (so the path is “/Users/[Your OS X user]/platform6”)
When using p6cmd for file submission, three folders are added beneath a folder named according to each target instance. For example, when targeting an instance with a name of dev
:
$ls -al $HOME/platform6/dev
total 16
drwxr-xr-x 6 simontemple staff 192 23 Feb 11:40 .
drwxr-xr-x 6 simontemple staff 192 21 Feb 18:24 ..
drwxr-xr-x 5 simontemple staff 160 23 Feb 11:38 error
drwxr-xr-x 2 simontemple staff 64 23 Feb 11:40 outbound
drwxr-xr-x 2 simontemple staff 64 15 Feb 10:17 sent
- a file that is selected for submission is moved into the
outbound
folder until the submission is complete - files that are accepted by the instance are moved to the
sent
folder once the submission is complete - files that are rejected by the instance are moved to the
error
folder is the submission fails. A file callederror.log
is also created in this folder that contains details of why the submission failed
User Permissions¶
A developer user must have permission messages=*
to perform foldermonitor or submit operations
Configuration and Customization for Message Submission¶
Please refer to Message Submission to configure your instance.
Attributes Set On The /new Endpoint¶
- script_name The name of the script to execute when a session is committed or closed
- [any] All other attributes will be forwarded to the MessageSubmission script as pipeline variables
Examples CLI Invocations¶
- File drop folder monitoring
- p6cmd will create a monitor folder for each instance the current user is associated with (and supports message submission) All files copied or dropped into the folder will be submitted to the associated instance. - The contents of the p6cmd.log in this case will look like this:
$p6cmd -monitorfolders Logging to: /Users/simontemple/.config/p6cmd/p6cmd.log
Version: 1.0.0, Build: 2022-02-23_03:57:34PM (d9ce0e2), Platform: darwin:amd64, Using: go1.17.6 (dev) on 8 CPUs. TimeZone: GMT (0)
INFO: 2022/02/23 15:59:09 restclient.go:189: Port assigned by OS: 56765
INFO: 2022/02/23 15:59:09 restclient.go:226: No http proxy enabled.
INFO: 2022/02/23 15:59:10 restclient.go:531: Created file monitor(s): 1
INFO: 2022/02/23 15:59:10 filestore.go:53: Ensuring file store structure...
INFO: 2022/02/23 15:59:11 filestore.go:97: File store structure ready: /Users/simontemple/platform6/dev
INFO: 2022/02/23 15:59:11 foldermonitor.go:211: Starting folder monitor...
Note
Folder monitoring once started will not end until the process is stopped via a SIGINT signal; via the command shell or process manager
- Submit a group of files to a single instance and exit
$p6cmd -instance dev -submit "/Users/simontemple/Downloads/*.csv" Logging to: /Users/simontemple/.config/p6cmd/p6cmd.log $ echo $? 2
- p6cmd will move the file(s) matching the pattern
~/Downloads/*.csv
to the instance folderdev
(creating it if does not already exist) and then attempts to submit the files - The exit code of
2
indicates that the submission failed (0 = sent without error). Examination of the error.log file in theerror
folder showsSubmission script not found: MessageSubmission
- MessageSubmission is the name of the script run on the instance as default. For this project the script has been called
CSVSubmission
so the p6cmd should be:
$p6cmd -instance dev -submit "/Users/simontemple/Downloads/*.csv" -sparam _script_name_=CSVSubmission -sparam foo=bar
Logging to: /Users/simontemple/.config/p6cmd/p6cmd.log
$ echo $?
0
Note
Multiple -sparam
arguments are allowed. Each key/value pair are passed as pipeline variables to the submission script.
Here, the reserved key of _script_name_
is being used to specify the name of the script to process this submission
Usage: Platform 6 Application (p6app) Lifecycle¶
Interaction with the Applications Service of a Platform 6 instance is possible using the app
command line argument with parameter values:
- list
- list-installed
- delete
- upload
- install
- uninstall
- upgrade
- rollback
- package-test
- create **
- verify ***
These capabilities were added to allow scripted application test, installation and upgrade.
Note
** The create
option is instance independent and is used to create an Application profile
(encoded file with .app extension)
An Application Profile is required before a developer can start constructing a P6 app
Note
*** The verify
option is instance independent and is used to mark a Platform 6 App file (.p6app) as verify (approved for distribution and deployment)
List/List-Installed¶
The list
command takes no arguments and produces a detailed list of all loaded applications on an instance.
The list-installed
command only lists installed
applications
Note
The APP ID
is a mandatory parameter to other commands.
When using the command you must provide one of those flags : -instance
or -all-instances
.
You can repeat the -instance
parameters.
$ p6cmd app list-installed --env dev --instance dev --instance wild-breeze-3764
$ p6cmd app list-installed --env dev --all-instances
Delete¶
The delete
command takes an APP ID
as parameter to specify the application to delete
$ p6cmd app delete 0c0280d10c4246258f23e4fe5d649ba4 --instance dev --env dev
✔ Using applications service on instance dev (dev)
✔ Delete of application: 0c0280d10c4246258f23e4fe5d649ba4 complete.
✔ App Action complete
Upload¶
The upload
command takes a path to a p6app file as a parameter. It will upload the app bundle ready for install or upgrade
$ p6cmd app upload /tmp/test_test_1_0_2_null.p6app --instance dev --env dev
✔ Using applications service on instance dev (dev)
2024/04/10 15:23:54 Failed handling application action: 'upload'
Code: 400
Message: Application upload failed! An application with the same key, version and status already exists.
$ p6cmd app upload /tmp/test_test_1_0_2_null.p6app --instance dev --env dev
✔ Using applications service on instance dev (dev)
✔ Upload of application file: /tmp/test_test_1_0_2_null.p6app complete.
✔ App Action complete
Install/Uninstall/Upgrade/Rollback/Package-Test¶
All these application bundle commands take an APP ID
as parameter
$ p6cmd app install 451209c88612411ca56456c381dbcf49 --instance dev --env dev
✔ Using applications service on instance dev (dev)
✔ App Action 'install' started...
Application installation started for: test-test ...
Checking target instance version and application version constraints.
De-serializing application components...
Installing bundled resources
Looking for pre-install script to install and execute
Warning! No scripts bundled with this application.
Starting to install service items.
Service: platform6.tables
Validating and deploying service items to: platform6.tables
Warning: Overwriting existing service item: test-test.TestTable
Added service item: test-test.TestTable
Service: platform6.scripts
Validating and deploying service items to: platform6.scripts
Service items installation complete.
Looking for post-install script to install and execute
Warning! No scripts bundled with this application.
Application Installation Complete.
Waiting for services to start...
Start of services completed!
✔ App Action complete
Note
The messages usually displayed on the user interface progress pane are now displayed on stdout in the terminal
$ p6cmd app uninstall 451209c88612411ca56456c381dbcf49 --instance dev --env dev
✔ Using applications service on instance dev (dev)
✔ App Action 'uninstall' started...
Application uninstall started for: test-test ...
Starting uninstall of service items.
Service: platform6.tables
Service: platform6.scripts
Service item uninstall complete.
Application Uninstall Complete.
Waiting for services to start...
Start of services completed!
✔ App Action complete
Errors and exceptions encountered by the Applications Service are also displayed
$ p6cmd app upgrade 6c58365ca1324b56af5707ecf9acf3a1 --instance dev --env dev
✔ Using applications service on instance dev (dev)
2024/04/10 15:35:10 Failed handling application action: 'upgrade'
Code: 500
Message: Unexpected error starting application action! Cannot use upgrade App without a defined upgrade or post upgrade script! test-test.6c58365ca1324b56af5707ecf9acf3a1
Detail: Cannot use upgrade App without a defined upgrade or post upgrade script! test-test.6c58365ca1324b56af5707ecf9acf3a1
Create¶
The creation of an Application Profile is a multistep process:
- Creation or installation of public/private key pair
- Creation of a JSON properties file
- Generation of
.app
file in the local filesystem
The deployment of an Application Profile is also a multistep process:
- The public key file must be attached to the organisational tree of the
*
instance at /Trusted Publishers/[app_publisher_id] - The App Profile file must be attached to the root node of the instance the app developer is to work on
Note
Deployment is straight forward using the Platform 6 Portal UI and requires orgs=edit
permission
Creation Step 1: Keypair creation¶
Public/private keys are a required part of Application security, ensuring only trusted application publishers can install their apps on Platform 6.
All Platform 6 Applications are signed using the private key when they are packaged and verified using the public key when they are installed.
An application publisher can generate the required key pair using the CLI:
$ p6cmd keygen
RSA key pair generated successfully!
✔ KeyGen Action complete
Warning
Running this command more than once can overwrite the key files, please ensure you have copies of these files before confirming the overwrite when prompted!
Key files are created in your p6cmd users configuration folder:
- key-private.pkcs8
- key-public.pem
Note
You can find your user configuration path using the command p6cmd config view --env <env>
Warning
Once a key pair has been generated for a “publisher” (i.e. Your organisation/company) all App Profiles created by your organisation should use the same key pair
Creation Step 2: JSON properties file¶
A JSON properties file is required as a mandatory input parameter to the app create
option.
In its most basic form it must contain an app.key
which is the globally unique id for the application.
Other optional properties:
- app.logo: Application logo data uri format: https://en.wikipedia.org/wiki/Data_URI_scheme (Use https://www.base64-image.de/)
- app.name.n: A list of locale specific names for the application, where n is a number from zero. The value is a comma separated key/value pair with key of the ISO 639-1 language code
- app.description.n: A list of locale specific descriptions for the application, where n is a number from zero. The value is a comma separated key/value pair with key of the ISO 639-1 language code
Note
A language code of EN
will be used as the default when no matching locale code is found
Examples:
{
"app.key": "ondiflo"
}
{
"app.key": "ondiflo",
"app.logo": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCABgAGADASIAAhEBAxEB/8QAHQAAAQQDAQEAAAAAAAAAAAAACAUGBwkBAwQCAP/EADkQAAECBQIDBgQEBQUBAAAAAAECAwAEBQYREiEHMUEIEyJRYXEUMkKBUpGhsSQzcsHRFRYjU2Pw/8QAGwEAAgMBAQEAAAAAAAAAAAAAAgMABAUGAQf/xAAnEQACAgICAQMEAwEAAAAAAAABAgADBBESIQUTIjEGFCNRMkFxkf/aAAwDAQACEQMRAD8AMuMGMnlHg+FO8SSYU4lKsE4PQRCvGHtC2tY8w7S6ak16st5StiXWA0yryWvln0G8NDtX8aXqG47Y9qzRbqK0ZqU20cql0EbNJPRZ6noIEJWVlSlKy4TlZJ5nzJ6kxRyMnidCXcfF5DbSTr77RXFCuOuIYrzVFlirKWaczyH9Z8X5xFdRvC7Kg8pycuqvTKyclS6g5+2Y55t5vvA22lS1fhSNo0/AvueNam2yeQ5QC2n5aOaoHpRFy3LouiU1uSdy1lheRhSZ9z/MSdZ/aC4nW68gKriavKj5mKijVq9NY8QiHZDTLsuBxaAQscjHUh5tR0ocSfeEPY4bYjlqXjphDp4Qdoa170dZpVUH+g1pzCUMvL1Mvq8kL8/Q7xNyFJ8xjG2DFVeD8w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Q6G5qutsJmwrnrSDt5whK5mF+7ZhtcwhpA8SE4V75hvxMYH0xuB5jh92/A7E7qNLPzk2ZWWYcfddQpKENoKlE48hD2kuEvERqnNVpFtTglgjvhy16ep08+UdvZuu2n2nxBacqUuhbM6n4UPkgGXKuSwT06H0g02dKFKdccbAKtbigvwgddxtjGYqZ2ZZSwUDqKxcdXHImBJbq22LopE0+nDTE80p0LGMICt85i0KVcSplKk8sJxv0wICCxbQpNcuiZnKtLpTaV3TszTZSbaRhclNNqJZWD9JKuXQwZtpyU/Tbdp8jU5xubnJZlLLj6E4DpSMasdNukNxeWtwcvjsAT/2Q==",
"app.name.0": "EN,Ondiflo",
"app.name.1": "FR,Ondiflo",
"app.description.0": "EN,Ondiflo: Tank Monitor",
"app.description.1": "FR,Ondiflo: Moniteur de réservoir"
}
Creation Step 3: App Profile Generation¶
Once the key pair and JSON files have been created/installed, generation of the Application Profile is simple:
$ p6cmd app create profile.json
The app.publisher.id
This value is defaulted to the p6cmd configuration property application/publisherId
and stored in the file psconfig.json
This value should be updated for publishing organisations other than Sidetrade. Configuration properties can be maintained via the WEB UI Settings
panel.
If this configuration value is removed/empty and is not specified directly in the JSON file, the app.published.id
will be auto generated and globally unique
The app.publisher.id is important and must be noted/retained for the following reasons:
- As a required part of the
Trusted Publishers
organisational tree - Must be used to regenerate the App Profile (for name or logo changed for example)
- Has an implicit link with the key pair used to generate it
The app.publisher.id
can be specified in the JSON properties file:
{
"app.key": "ondiflo",
"app.publisher.id": "apps@sidetrade.io"
}
Warning
It is essential that the key-pair and app.publisher.id
are always used together.
$ p6cmd app create profile.json
Verify¶
App (Connector App) verification is the process of awarding a .p6app file with a verified
status.
This signifies that the content has been quality checked by one or more Platform 6 moderators and the App passed all current quality checks.
Warning
This option must only be used by Platform 6 App moderators
The verify
action does not perform quality checks, it simply marks the App as verified.
$ p6cmd app verify Amalto_O2C_2_0_3_final.p6app
✔ App Action complete
However, if the App is already verify:
$ p6cmd app verify Amalto_O2C_2_0_3_final.p6app
2025/01/20 14:12:08 Failed handling application action: 'verify' file already verify encoded
Usage: Platform 6 Instance Actions¶
Interaction with the Authorisation Service of Platform 6 is possible using the instance
command line argument:
- list
- inventory
The list
capability was added to allow scripted operations that require instance id. (technical identifier)
List¶
The list
command takes no arguments and produces a detailed list of all instances the current user has permission to use
$ p6cmd instance list
The deployed-only
flag can be used to filters the instances : instances used for local development will be removed from the results.
$ p6cmd instance list --env dev --deployed-only
Inventory¶
The inventory
command takes no arguments and display the network/cloud configurations used for the deployment of the instances :
- instance ID
- region (EU or NA or ?>)
- hostname
- cloud (sidetrade or ovh or digital ocean or ??>)
- p6 proxy
Note
This action requires the p6cmd user to be connected to the Sidetrade network because of nslookup in the backend : region and cloud values can be retrieved by checking the private IP of the p6core instance.
$ p6cmd instance inventory --env dev
Usage: Platform 6 Upgrade Actions¶
Auto-Upgrade Initiation
via the Applications Service of Platform 6 is possible using the upgrade
action with either of the arguments:
- full
- core
Note
This action only initiates
the upgrade, it does not wait until the upgrade is complete. A successful initiation will result in a P6 job-id being returned.
During the auto-upgrade, there is a risk of increasing the workload on the p6 services, this can be avoided by doing upgrade by groups and add a pause between each group upgrade.
To perform upgrade by groups, use the --limit
parameter (default value 5
). By default a pause of 300
secondes is done before proceeding the next group, this pause can be overridden with the parameter --delay
.
core¶
Will upgrade the Platform 6 docker container to the :latest
This means the most recent release of the container called p6core
with the latest
tag
If there has been no new release of p6core newer than that running, no action will be performed.
Note
In fact any container named p6*
will be upgraded. This will ensure auto-update of and Platform 6 Sidecar type containers also
$ p6cmd upgrade core --env dev --limit 5 --delay 60 --instance green-night-1211
2024-09-25 11:03:49 [go-routine][green-night-1211] Request upgrade to p6core instance ...
2024-09-25 11:03:50 [go-routine][green-night-1211] Job ID : 040867a14c5a4c09a9db550d806988ca
2024-09-25 11:03:50 [go-routine][green-night-1211] Request is completed
✔ Instance Upgrade Action complete
full¶
Will upgrade all installed applications
to the @latest
and also perform a core upgrade
This means that for each installed application the P6 Application Repository
will be checked for a newer version using the @latest
tag
When newer versions exist, the current versions will be uninstalled and following the core
upgrade the latest version of each of the Applications is installed
$ p6cmd upgrade full --env dev --limit 5 --delay 60 --instance aged-sound-4025 --instance green-night-1211
2024-09-20 08:34:17 [go-routine][green-night-1211] Request upgrade to p6core instance ...
2024-09-20 08:34:17 [go-routine][aged-sound-4025] Request upgrade to p6core instance ...
2024-09-20 08:34:17 [go-routine][aged-sound-4025] Job ID : 4c11e6f161864f918e56f3d6311acd07
2024-09-20 08:34:17 [go-routine][aged-sound-4025] Request is completed
2024-09-20 08:34:17 [go-routine][green-night-1211] Job ID : 61ea58f3a10e4fa38137eed163ab986a
2024-09-20 08:34:17 [go-routine][green-night-1211] Request is completed
✔ Instance Upgrade Action complete
User Permissions¶
The p6cmd user must have the permission instance=upgrade
to perform upgrade
operations and be associated with the instance (or *
admin)
$p6cmd upgrade core --env dev --instance dev
✔ Using applications service on instance dev (dev)
2024/07/22 17:02:44 Failed handling instance upgrade action: 'core'
Code: 404
Message: HTTP 404 Not Found
Warning
Upgrade initiation is only supported on Platform instances version 6.10.4 onwards Instances that do not support upgrade initiation will return 404!
JSON Formatted Output¶
The new argument --json
can be added to the command line to request output written to stdout is formatted as JSON
Not all CLI actions support this format selector. Those that do are: - instanceaction - appaction - upgrade
Example:
$ p6cmd instance list --json
[
{
"Enabled": true,
"Name": "*",
"DisplayName": "",
"InstanceType": "CORE",
"Description": "b2Auth Authentication Server",
"Picture": "",
"Properties": {
"baseContext": "https://login.amalto.com",
"infoPath": "/apis/v2/info"
},
"IsLocal": false,
"Version": "",
"P6Proxy": ""
},
{
"Enabled": true,
"Name": "Airswift_Prod",
"DisplayName": "",
"InstanceType": "CORE",
"Description": "Airswift - Prod",
"Picture": "",
"Properties": {
"baseContext": "https://prod.airswift.sidetrade.io/b2box/rest/resource",
"infoPath": "/apis/v2.1/info"
},
"IsLocal": false,
"Version": "5.24.21",
"P6Proxy": ""
},
{
"Enabled": true,
"Name": "autumn-cloud-5131",
"DisplayName": "Kal-Tire_v6_Prod",
"InstanceType": "CORE",
"Description": "Kal Tire V6 Prod instance",
"Picture": "",
"Properties": {
"baseContext": "https://prod.kaltire-v6.sidetrade.io/p6",
"emailTemplateOverride": "sidetrade",
"infoPath": "/apis/v2.1/info"
},
"IsLocal": false,
"Version": "6.10.4",
"P6Proxy": "p6caddy/1.1.3"
},
{
"Enabled": true,
"Name": "Bell-Supply_Prod",
"DisplayName": "",
"InstanceType": "CORE",
"Description": "Bell Supply - Prod",
"Picture": "",
"Properties": {
"baseContext": "https://prod.bell.b2box.com/b2box/rest/resource",
"infoPath": "/apis/v2.1/info"
},
"IsLocal": false,
"Version": "5.24.21",
"P6Proxy": "nginx/1.23.4"
},
{
"Enabled": true,
"Name": "blue-truth-1738",
"DisplayName": "Pro-Mach_Prod",
"InstanceType": "CORE",
"Description": "Pro-Mach Prod instance",
"Picture": "",
"Properties": {
"baseContext": "https://prod.promach.sidetrade.io/p6",
"infoPath": "/apis/v2.1/info"
},
"IsLocal": false,
"Version": "6.10.7",
"P6Proxy": "p6caddy/1.1.3"
},
<snip>
Note
This format is much easier to parse and integrate into automated pipelines
Authentication Credential Provision¶
Three environment variables can be used:
- P6CMD_TOKEN_TYPE
- P6CMD_REFRESH_TOKEN
- USE_P6CMD_CREDENTIAL_FILE
Note
These values override any values stored in credentials files
Warning
Each time you run p6cmd with environment variable, a new bearer token is generated and will not be reused. To prevent this, you can use the environment variable USE_P6CMD_CREDENTIAL_FILE set to 1. p6cmd will automatically switch to the credential file as soon as the file is created in the system.
For example:
export P6CMD_TOKEN_TYPE=Bearer
export P6CMD_REFRESH_TOKEN=d438577fa4fa9ac4d15c2395152e88fA1
export USE_P6CMD_CREDENTIAL_FILE=1
Depending upon the execution environment (dev,staging or prod) the file:
- [env].p6cmd_credentials.json
is usually used. This file is created after a successful sign-in via the browser.
Note
Once created, the refresh token can be copied from this file for use as an environment variable.
Switching Environments¶
The files:
- dev.p6cmd_credentials.json
- staging.p6cmd_credentials.json
- prod.p6cmd_credentials.json
can all exist in the p6cmd auth folder and selected using the --env
command line argument.
You can inspect the p6cmd credentials with config
command.
$ p6cmd config view --env dev
Reading dev credential at C:\Users\ilangovane.ragavanan\AppData\Roaming\p6cmd\dev.p6cmd_credentials.json...
Access token found :
* Issuer : http://amalto.com
* Subject : p6cmd
* Expiration : 2025-02-06 16:01:15 +0000 UTC
* Not valid before : 2025-02-06 15:01:15 +0000 UTC
* Issued at : 2025-02-06 15:01:15 +0000 UTC
* Type of token : JWT
* Realm : b2
* User : ilangovane.ragavanandane@sidetrade.com
✔ Config Action complete
$ p6cmd config view --env staging
Reading staging credential at C:\Users\ilangovane.ragavanan\AppData\Roaming\p6cmd\staging.p6cmd_credentials.json...
Access token found :
* Issuer : http://amalto.com
* Subject : p6cmd
* Expiration : 2025-02-06 15:51:12 +0000 UTC
* Not valid before : 2025-02-06 14:51:12 +0000 UTC
* Issued at : 2025-02-06 14:51:12 +0000 UTC
* Type of token : JWT
* Realm : b2
* User : ilangovane.ragavanandane@sidetrade.com
✔ Config Action complete
$ p6cmd config view --env prod
Reading prod credential at C:\Users\ilangovane.ragavanan\AppData\Roaming\p6cmd\prod.p6cmd_credentials.json...
Access token found :
* Issuer : http://amalto.com
* Subject : p6cmd
* Expiration : 2025-02-06 15:49:32 +0000 UTC
* Not valid before : 2025-02-06 14:49:32 +0000 UTC
* Issued at : 2025-02-06 14:49:32 +0000 UTC
* Type of token : JWT
* Realm : b2
* User : ilangovane.ragavanandane@sidetrade.com
✔ Config Action complete