Skip to content

Commit

Permalink
Tom's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benjih committed Apr 18, 2017
1 parent 2055ccb commit f83fbdd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hoverctl mode -t remote capture
hoverctl -t remote mode capture
curl --proxy http://my-user:[email protected]:8555 http://ip.jsontest.com
hoverctl mode -t remote simulate
hoverctl -t remote mode simulate
curl --proxy http://my-user:[email protected]:8555 http://ip.jsontest.com
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
hoverctl start --auth \
--admin-port 8880 \
--proxy-port 8555
hoverctl start --auth
49 changes: 26 additions & 23 deletions docs/pages/tutorials/advanced/proxyauth/proxyauth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,53 @@ Hoverfly can provide authentication for both the admin API
Setting Hoverfly authentication credentials
-------------------------------------------

To start Hoverfly with authentication, all we need to do is run
the ``hoverctl start`` command with the flag authentication flag.
To start a Hoverfly instance with authentication enabled, you need to run
the ``hoverctl start`` command with the authentication (``--auth``) flag.

.. literalinclude:: hoverfly-start-proxy-auth.sh
:language: sh

Running this command will prompt you to enter a username and
password. This can be bypassed by providing the ``-username``
and ``--password`` flags, though this will leave credentials
in your terminal history.
Running this command will prompt you to set a username and
password for the Hoverfly instance.

This can be bypassed by providing the ``--username``
and ``--password`` flags, although **this will leave credentials
in your terminal history**.

.. warning::

By default, hoverctl will start Hoverfly with authentication disabled. If you require authentication
you must make sure the ``--auth`` flag are supplied every time Hoverfly is started.

Logging in with hoverctl
------------------------
Logging in to a Hoverfly instance with hoverctl
-----------------------------------------------

Now that Hoverfly has started, trying to interact with it using
hoverctl will now result in an authentication error. You will now
need to login with hoverctl.
Now that a Hoverfly instance has started with authentication enabled, you will need to
**login** to the instance using hoverctl.

.. literalinclude:: login-hoverctl.sh
:language: sh

This will log you in with the default target, assuming that the
Hoverfly instance was started with this target.
Running this command will prompt you to enter the username and
password you set for the Hoverfly instance. Again, this can be bypassed by providing the ``--username``
and ``--password`` flags.

There may be situations where a Hoverfly process is started
externally to hoverctl. When this happens, it is often
best practice to create a new target for it. You can do this
with the login command using the ``--new-target`` flag.
There may be situations in which you need to log into to a Hoverfly instance
that is already running. In this case, it is best practice to create a new **target**
for the instance (please see :ref:`remotehoverfly` for more information on **targets**). You can do this using
the ``--new-target`` flag.

In this example, a remote Hoverfly instance has been started
already for us on the ports 8880 and 8550 (the example from
:ref:`remotehoverfly`). To get started, we need to create a
new target and log in with it.
In this example, a remote Hoverfly instance is already running on the host ```hoverfly.example.com```, with
the ports set to 8880 and 8555 and authentication enabled (the example from :ref:`remotehoverfly`).
You will need to create a new target (named ``remote``) for the instance and log in with it.

.. literalinclude:: login-hoverctl-new-target.sh
:language: sh

Run the following commands to capture and simulate a URL using the
You will be prompted to enter the username and password for the instance.

Now run the following commands to capture and simulate a URL using the
remote Hoverfly:

.. literalinclude:: curl-proxy-basic-auth.sh
:language: sh
:language: sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hoverctl mode -t remote capture
hoverctl -t remote mode capture
curl --proxy http://hoverfly.example.com:8555 http://ip.jsontest.com
hoverctl mode -t remote simulate
hoverctl -t remote mode simulate
curl --proxy http://hoverfly.example.com:8555 http://ip.jsontest.com
14 changes: 7 additions & 7 deletions docs/pages/tutorials/advanced/remotehoverfly/remotehoverfly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Controlling a remote Hoverfly instance with hoverctl
So far, the tutorials have shown how hoverctl can be used to control an instance of Hoverfly running on the same machine.

In some cases, you may wish to use hoverctl to control an instance of Hoverfly running on a remote host. With hoverctl,
we can do this using the targets feature.
you can do this using the **targets** feature.

In this example, we assume that the remote host is reachable at ``hoverfly.example.com``, and that
ports ``8880`` and ``8555`` are available. We will also assume that the Hoverfly binary is installed on the remote host.
Expand All @@ -20,20 +20,20 @@ On the **remote host**, start Hoverfly using flags to override the default admin
For a full list of all Hoverfly flags, please refer to :ref:`hoverfly_commands` in the :ref:`reference` section.


On your **local machine**, we will create the ``remote`` target using hoverctl. This target will be configured to communicate
On your **local machine**, you can create a **target** named ``remote`` using hoverctl. This target will be configured to communicate
with Hoverfly.

.. literalinclude:: create-hoverctl-target.sh
:language: none

Now that hoverctl knows the location of the remote Hoverfly instance, run the following commands
**on your local machine** to capture and simulate a URL using the remote Hoverfly:
Now that hoverctl knows the location of the ``remote`` Hoverfly instance, run the following commands
**on your local machine** to capture and simulate a URL using this instance:

.. literalinclude:: curl-proxy-remote-hoverfly.sh
:language: sh

You will now need to specific the ``remote`` target every time you want to interact with this remote Hoverfly instance.
If you are working only with this one remote instance, it is possible to change the default target in hoverctl.
You will now need to specify the ``remote`` target every time you want to interact with this Hoverfly instance.
If you are only working with this remote instance, you can set it to be the default target instance for hoverctl.

.. literalinclude:: default-hoverctl-target.sh
:language: sh
Expand All @@ -46,4 +46,4 @@ If you are working only with this one remote instance, it is possible to change
use the remote Hoverfly instance as a proxy. In this example, it is done using cURL's ``--proxy`` flag.

If you are running Hoverfly on a remote host, you may wish to enable authentication on the Hoverfly proxy and admin API.
This is described in the :ref:`proxyauth` tutorial.
This is described in the :ref:`proxyauth` tutorial.

0 comments on commit f83fbdd

Please sign in to comment.