mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add GALAXY_TOKEN config option (#34621)
This change lets user store token in configuration file or environment to prevent exposing the secret on the command line.
This commit is contained in:
parent
92b3d79283
commit
576335e53d
2 changed files with 13 additions and 3 deletions
|
@ -545,6 +545,9 @@ class GalaxyCLI(CLI):
|
||||||
"""
|
"""
|
||||||
# Authenticate with github and retrieve a token
|
# Authenticate with github and retrieve a token
|
||||||
if self.options.token is None:
|
if self.options.token is None:
|
||||||
|
if C.GALAXY_TOKEN:
|
||||||
|
github_token = C.GALAXY_TOKEN
|
||||||
|
else:
|
||||||
login = GalaxyLogin(self.galaxy)
|
login = GalaxyLogin(self.galaxy)
|
||||||
github_token = login.create_github_token()
|
github_token = login.create_github_token()
|
||||||
else:
|
else:
|
||||||
|
@ -552,7 +555,7 @@ class GalaxyCLI(CLI):
|
||||||
|
|
||||||
galaxy_response = self.api.authenticate(github_token)
|
galaxy_response = self.api.authenticate(github_token)
|
||||||
|
|
||||||
if self.options.token is None:
|
if self.options.token is None and C.GALAXY_TOKEN is None:
|
||||||
# Remove the token we created
|
# Remove the token we created
|
||||||
login.remove_github_token()
|
login.remove_github_token()
|
||||||
|
|
||||||
|
|
|
@ -1230,6 +1230,13 @@ GALAXY_SERVER:
|
||||||
ini:
|
ini:
|
||||||
- {key: server, section: galaxy}
|
- {key: server, section: galaxy}
|
||||||
yaml: {key: galaxy.server}
|
yaml: {key: galaxy.server}
|
||||||
|
GALAXY_TOKEN:
|
||||||
|
default: null
|
||||||
|
description: "GitHub personnal access token"
|
||||||
|
env: [{name: ANSIBLE_GALAXY_TOKEN}]
|
||||||
|
ini:
|
||||||
|
- {key: token, section: galaxy}
|
||||||
|
yaml: {key: galaxy.token}
|
||||||
HOST_KEY_CHECKING:
|
HOST_KEY_CHECKING:
|
||||||
name: Check host keys
|
name: Check host keys
|
||||||
default: True
|
default: True
|
||||||
|
|
Loading…
Reference in a new issue