Skip to content

Commit e525234

Browse files
(DOCSP-11094, DOCSP-11068): Update mongocli config output and default profile behavior (#178)
* (DOCSP-11094): List project by name on config * (DOCSP-11068): Improve use of defaut profile * tech review * copy review * tech review 2
1 parent 6ccfa92 commit e525234

13 files changed

+283
-172
lines changed

source/configure/autocomplete.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ Use ``Tab`` to Autocomplete Commands
7777
------------------------------------
7878

7979
Once you have autocomplete configured, you can autocomplete commands by
80-
typing ``mongocli`` in your shell and pressing the ``Tab`` key. Press
81-
``Tab`` multiple times to cycle through available autocompletion
80+
typing ``mongocli`` in your shell and pressing the :kbd:`Tab` key. Press
81+
:kbd:`Tab` multiple times to cycle through available autocompletion
8282
options.
8383

84-
You can press ``Tab`` at any stage of writing your command to see
84+
You can press :kbd:`Tab` at any stage of writing your command to see
8585
available autocomplete options.
8686

8787
Examples
8888
~~~~~~~~
8989

90-
When you type ``mongocli`` in your shell and press ``Tab``, the output
91-
resembles the following:
90+
When you type ``mongocli`` in your shell and press :kbd:`Tab`, the
91+
output resembles the following:
9292

9393
.. code-block:: none
9494
:copyable: false
@@ -106,7 +106,7 @@ command, you can see autocompletion options for your selected
106106
property.
107107

108108
For example, when you type ``mongocli atlas`` in your shell and press
109-
``Tab``, the output resembles the following:
109+
:kbd:`Tab`, the output resembles the following:
110110

111111
.. code-block:: none
112112
:copyable: false

source/configure/configuration-file.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,40 @@ Profiles
3737
--------
3838

3939
The {+mcli+} configuration file stores related settings and
40-
|api| keys in groups called *profiles*. You can create or define
40+
|api| keys in groups called *profiles*. You can :ref:`create
41+
<mcli-config-command>` or :ref:`define <mcli-config-set-command>`
4142
multiple profiles so that you can use the {+mcli+} to access different
4243
MongoDB services or projects from the same terminal.
4344

45+
.. note::
46+
47+
Any settings stored in :ref:`envronment variables <mcli-env-var>`
48+
take precedence over settings stored in profiles.
49+
4450
To run {+mcli+} with a specific profile, append the ``--profile
45-
<profileName>`` option to the command. If you omit the ``--profile``
46-
parameter, {+mcli+} looks for a profile named ``default`` in the
47-
configuration file.
51+
<profileName>`` option to the command.
52+
53+
Default Profile
54+
~~~~~~~~~~~~~~~
55+
56+
If you run a command without the ``--profile`` option, the {+mcli+} uses
57+
the settings in the default profile. The {+mcli+} determines the default
58+
profile by the number of profiles you have configured:
59+
60+
- If you have only one profile, the {+mcli+} uses that profile as the
61+
default.
62+
- If you have multiple profiles, the {+mcli+} uses the profile named
63+
``default`` as the default. If you don't have a profile named
64+
``default`` and run a command that requires certain settings, the
65+
{+mcli+} returns an error for the missing settings.
4866

4967
Example
5068
-------
5169

5270
The following example configuration file contains two profiles,
5371
``default`` and ``myOpsManager``.
5472

55-
The ``default`` profile connects to a |service| deployment and contains
73+
The ``default`` profile connects to an |service| deployment and contains
5674
the following settings:
5775

5876
- An organization ID

source/includes/steps-configure-mcli-atlas.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,24 @@ source:
1111
ref: enter-api-key
1212
replacement:
1313
apiKeys: ":atlas:`Programmatic API Key </configure-api-access>`"
14-
projectId: ":atlas:`Project ID </tutorial/manage-project-settings/>`"
1514
service: "|service|"
1615
---
1716
stepnum: 3
17+
source:
18+
file: steps-configure-mcli.yaml
19+
ref: enter-orgid
20+
---
21+
stepnum: 4
22+
source:
23+
file: steps-configure-mcli.yaml
24+
ref: enter-projectid
25+
---
26+
stepnum: 5
1827
source:
1928
file: steps-configure-mcli.yaml
2029
ref: verify-profile
2130
replacement:
2231
service: "|service|"
2332
serviceName: "cloud"
33+
opsMgrUrl: ""
2434
...

source/includes/steps-configure-mcli-cm.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,25 @@ source:
1010
file: steps-configure-mcli.yaml
1111
ref: enter-api-key
1212
replacement:
13-
apiKeys: ":cloudmgr:`Cloud Manager API Access </tutorial/configure-public-api-access>`"
14-
projectId: ":cloudmgr:`Project ID </tutorial/manage-project-settings/>`"
13+
apiKeys: ":cloudmgr:`API keys </tutorial/configure-public-api-access>`"
1514
service: "|cloud|"
1615
---
1716
stepnum: 3
17+
source:
18+
file: steps-configure-mcli.yaml
19+
ref: enter-orgid
20+
---
21+
stepnum: 4
22+
source:
23+
file: steps-configure-mcli.yaml
24+
ref: enter-projectid
25+
---
26+
stepnum: 5
1827
source:
1928
file: steps-configure-mcli.yaml
2029
ref: verify-profile
2130
replacement:
2231
service: "|cloud|"
2332
serviceName: "cloud-manager"
33+
opsMgrUrl: ""
2434
...

source/includes/steps-configure-mcli-om.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,25 @@ source:
1515
file: steps-configure-mcli.yaml
1616
ref: enter-api-key
1717
replacement:
18-
apiKeys: ":opsmgr:`Ops Manager API Acess </tutorial/configure-public-api-access>`"
19-
projectId: ":opsmgr:`Project ID </tutorial/manage-project-settings/>`"
18+
apiKeys: ":opsmgr:`API keys </tutorial/configure-public-api-access>`"
2019
service: "|onprem|"
2120
---
2221
stepnum: 4
22+
source:
23+
file: steps-configure-mcli.yaml
24+
ref: enter-orgid
25+
---
26+
stepnum: 5
27+
source:
28+
file: steps-configure-mcli.yaml
29+
ref: enter-projectid
30+
---
31+
stepnum: 6
2332
source:
2433
file: steps-configure-mcli.yaml
2534
ref: verify-profile
2635
replacement:
2736
service: "|onprem|"
2837
serviceName: "ops-manager"
38+
opsMgrUrl: "ops_manager_url = https://mms.example.com:8080/"
2939
...

source/includes/steps-configure-mcli.yaml

Lines changed: 98 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ content: |
99
.. tab:: Default Profile
1010
:tabid: default-profile
1111
12-
This command creates a profile called ``default`` in the
13-
:ref:`mcli-config-file`. The {+mcli+} uses this profile by
14-
default.
12+
This command creates a :ref:`profile <mcli-profiles>` called
13+
``default`` in the :ref:`mcli-config-file`.
1514
1615
Run the :ref:`mcli-config-command` command:
1716
@@ -22,48 +21,117 @@ content: |
2221
.. tab:: Named Profile
2322
:tabid: named-profile
2423
25-
This command creates a profile with a custom name in the
26-
:ref:`mcli-config-file`. To use this profile, you must specify
27-
it with the ``--profile`` flag in every {+mcli+} command.
24+
This command creates a :ref:`profile <mcli-profiles>` with a
25+
custom name in the :ref:`mcli-config-file`. To use this profile
26+
in a command, you must specify the profile with the
27+
``--profile`` flag.
2828
2929
Run the :ref:`mcli-config-command` command:
3030
3131
.. code-block:: sh
3232
3333
mongocli config {{serviceOption}} --profile <profile-name>
34-
34+
3535
---
36-
title: "Enter your |onprem| Base |url|"
36+
title: "Create a profile for the {{service}} project."
37+
stepnum: 0
38+
level: 4
39+
ref: quick-create-profile
40+
content: |
41+
Run the following :ref:`command <mcli-config-command>` to create a
42+
:ref:`profile <mcli-profiles>` called ``default``.
43+
44+
.. code-block:: sh
45+
46+
mongocli config {{serviceOption}}
47+
48+
---
49+
title: "Enter the :opsmgr:`URL you use to access Ops Manager </reference/config/ui-settings/#URL-to-Access-Ops-Manager>`."
3750
stepnum: 0
3851
level: 4
3952
ref: enter-base-url
4053
content: |
41-
The |onprem| Base |url| is the :opsmgr:`URL you use to access Ops
42-
Manager </reference/config/ui-settings/#URL-to-Access-Ops-Manager>`.
4354
4455
.. code-block:: sh
56+
:copyable: false
4557
46-
? Ops Manager Base URL: http://mms.example.com:8080
58+
? URL to Access Ops Manager: http://mms.example.com:8080
4759
4860
---
49-
title: "Enter your {{apiKeys}} and {{projectId}}."
61+
title: "Enter your {{apiKeys}}."
5062
stepnum: 0
5163
level: 4
64+
optional: true
5265
ref: enter-api-key
5366
content: |
5467
55-
When prompted, enter the ``Public API Key``, ``Private API Key``, and
56-
``Project ID`` for your {{service}} deployment.
68+
When prompted, enter the ``Public API Key`` and ``Private API Key``
69+
for your {{service}} deployment.
5770
5871
.. code-block:: sh
5972
:copyable: false
6073
6174
? Public API Key: abcdef
62-
? Private API Key: [? for help] ************************************
63-
? Project ID [optional]: 7ehf04abc10defb66c7d1234c
75+
? Private API Key: [? for help]
76+
************************************
77+
78+
---
79+
title: "Choose your default organization."
80+
stepnum: 0
81+
level: 4
82+
ref: enter-orgid
83+
content: |
84+
85+
If you entered |api| keys, the command displays the name and ID of organizations that your |api| key can access.
86+
87+
a. Select your organization:
88+
89+
- Press the :kbd:`Down Arrow` and :kbd:`Up Arrow`
90+
keys to highlight the desired organization, or
91+
- Type the organization name to filter the available
92+
organizations.
93+
94+
.. code-block:: sh
95+
:copyable: false
96+
97+
? Choose a default organization: [Use arrows to move, type to filter]
98+
> Org1 (5e39bf1212121e685774c81c)
6499
65-
If you don't save your project ID in your profile, you must specify
66-
the ``--projectId`` option every time you run a {+mcli+} command.
100+
#. Press :kbd:`Enter`.
101+
102+
If you didn't enter |api| keys, the command prompts you to enter your
103+
``Default Project ID``.
104+
105+
---
106+
title: "Choose your default project."
107+
stepnum: 0
108+
level: 4
109+
ref: enter-projectid
110+
content: |
111+
112+
If you entered |api| keys, the command displays the name and ID of
113+
projects that your |api| key can access.
114+
115+
a. Select your project:
116+
117+
- Press the :kbd:`Down Arrow` and :kbd:`Up Arrow`
118+
keys to highlight the desired project, or
119+
- Type the project name to filter the available
120+
projects.
121+
122+
.. code-block:: sh
123+
:copyable: false
124+
125+
? Choose a default project: [Use arrows to move, type to filter]
126+
Project1 (5e5ebffd0c04a97009061234)
127+
Project2 (5cfacee6014b761b07f15678)
128+
> Project3 (5e39bf4979358e6857741212)
129+
Project4 (5c815cc7014b768fb67e3434)
130+
131+
#. Press :kbd:`Enter`.
132+
133+
If you didn't enter |api| keys, the command prompts you to enter your
134+
``Default Organization ID``.
67135
68136
---
69137
title: "Verify your profile."
@@ -85,49 +153,51 @@ content: |
85153
86154
.. example::
87155
88-
In this example, the following command returns the settings
156+
The following command returns the settings
89157
in the {+default-profile+}:
90158
91159
.. code-block:: sh
92160
:copyable: false
93161
94162
mongocli config describe default
95163
96-
The command returns the following settings. The {+default-profile+}
97-
has a |svc-api-key|, which is redacted in the command output for
98-
security purposes, and project ID for an {{service}} deployment.
164+
The command returns the following settings. For security
165+
purposes, the command redacts |api| keys in the output.
99166
100167
.. code-block:: sh
101168
:copyable: false
102169
170+
{{opsMgrUrl}}
171+
org_id = 5f1f39ffc902201990f12345
103172
private_api_key = redacted
104-
public_api_key = redacted
105173
project_id = 7ehf04abc10defb66c7d1234c
174+
public_api_key = redacted
106175
service = {{serviceName}}
107176
108177
.. tab:: Named Profile
109178
:tabid: named-profile
110179
111180
.. example::
112181
113-
In this example, the following command returns the settings
182+
The following command returns the settings
114183
in the profile named ``myMongoDB``:
115184
116185
.. code-block:: sh
117186
:copyable: false
118187
119188
mongocli config describe myMongoDB
120189
121-
The command returns following settings. The ``myMongoDB`` profile
122-
has a |svc-api-key|, which is redacted in the command output for
123-
security purposes, and project ID for an {{service}} deployment.
190+
The command returns following settings. For security
191+
purposes, the command redacts |api| keys in the output.
124192
125193
.. code-block:: sh
126194
:copyable: false
127195
196+
{{opsMgrUrl}}
197+
org_id = 5f1f39ffc902201990f12345
128198
private_api_key = redacted
129-
public_api_key = redacted
130199
project_id = 7ehf04abc10defb66c7d1234c
200+
public_api_key = redacted
131201
service = {{serviceName}}
132202
133203
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
stepnum: 1
22
source:
3-
file: steps-quick-start-config-mcli.yaml
3+
file: steps-configure-mcli.yaml
44
ref: quick-create-profile
55
replacement:
66
mdbService: Atlas
77
serviceOption: ""
88
---
99
stepnum: 2
1010
source:
11-
file: steps-quick-start-config-mcli.yaml
12-
ref: config-enter-credentials
11+
file: steps-configure-mcli.yaml
12+
ref: enter-api-key
13+
replacement:
14+
apiKeys: ":atlas:`Programmatic API Key </configure-api-access>`"
15+
service: "|service|"
1316
---
1417
stepnum: 3
1518
source:
16-
file: steps-quick-start-config-mcli.yaml
17-
ref: config-enter-projectid
19+
file: steps-configure-mcli.yaml
20+
ref: enter-orgid
21+
---
22+
stepnum: 4
23+
source:
24+
file: steps-configure-mcli.yaml
25+
ref: enter-projectid
1826
...

0 commit comments

Comments
 (0)