PlatformIO Auth Token command

This commit is contained in:
Ivan Kravets
2016-11-02 19:43:45 +02:00
parent fa11217da7
commit ac3ebab070
6 changed files with 77 additions and 2 deletions

View File

@ -11,6 +11,7 @@ PlatformIO 3.0
Your devices are always with you!
* `PIO Account <http://docs.platformio.org/en/latest/userguide/account/index.html>`__
for extra professional features from `PlatformIO Plus <https://pioplus.com>`__
and ``PLATFORMIO_AUTH_TOKEN`` environment variable for CI systems
* Inject system environment variables to configuration settings in
`Project Configuration File "platformio.ini" <http://docs.platformio.org/en/stable/projectconf.html>`__
(`issue #792 <https://github.com/platformio/platformio/issues/792>`_)

View File

@ -21,6 +21,19 @@ will behave on a computer.
*PlatformIO* handles variables which start with ``PLATFORMIO_`` prefix. They
have the **HIGHEST PRIORITY**.
How to set environment variable?
.. code-block:: bash
# Windows
set VARIABLE_NAME=VALUE
# Unix (bash, zsh)
export VARIABLE_NAME=VALUE
# Unix (fish)
set -x VARIABLE_NAME VALUE
.. contents::
General
@ -38,6 +51,15 @@ PlatformIO uses it to disable prompts and progress bars. In other words,
``CI=true`` automatically setup :envvar:`PLATFORMIO_DISABLE_PROGRESSBAR` to
``true``.
.. envvar:: PLATFORMIO_AUTH_TOKEN
Allows to specify Personal Authentication Token that could be used for
automatic login in to :ref:`cmd_account`. It is very useful for :ref:`ci`
systems and :ref:`pio_remote` operations where you are not able manually authorize.
You can get own Personal Authentication Token using :ref:`cmd_account_token`
command.
.. envvar:: PLATFORMIO_FORCE_COLOR
Force to output color ANSI-codes even if the output is a ``pipe`` (not a ``tty``).
@ -165,7 +187,6 @@ Allows to override setting :ref:`setting_enable_telemetry`.
Allows to override setting :ref:`setting_force_verbose`.
.. envvar:: PLATFORMIO_SETTING_ENABLE_SSL
Allows to override setting :ref:`setting_enable_ssl`.

View File

@ -27,7 +27,9 @@ Usage
Description
-----------
Log in to :ref:`cmd_account`.
Log in to :ref:`cmd_account`. If you are not able to provide authentication
credentials manually you can use :envvar:`PLATFORMIO_AUTH_TOKEN`. This is
very useful for :ref:`ci` systems and :ref:`pio_remote` operations .
Options
~~~~~~~

View File

@ -0,0 +1,44 @@
.. Copyright 2014-present PlatformIO <contact@platformio.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.. _cmd_account_token:
platformio account token
===========================
.. contents::
Usage
-----
.. code-block:: bash
platformio account token
Description
-----------
Get or regenerate Personal Authentication Token. It is very useful for :ref:`ci`
systems, :ref:`pio_remote` operations where you are not able manually authorize.
PlatformIO handles Personal Authentication Token from environment variable
:envvar:`PLATFORMIO_AUTH_TOKEN`.
Options
~~~~~~~
.. program:: platformio account token
.. option::
--regenerate
If this option is specified a new authentication token will be generated.

View File

@ -38,3 +38,4 @@ To print all available commands and options use:
cmd_logout
cmd_password
cmd_register
cmd_token

View File

@ -49,6 +49,12 @@ def account_password():
pioplus_call(sys.argv[1:])
@cli.command("token", short_help="Get or regenerate Authentication Token")
@click.option("--regenerate", is_flag=True)
def account_token(**kwargs):
pioplus_call(sys.argv[1:])
@cli.command("forgot", short_help="Forgot password")
@click.option("-u", "--username")
def account_forgot(**kwargs):