-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
CRUD for EnvironmentVariables from Project's admin #4899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
1884e62
ac572ba
f01bbbe
9a20328
74274cf
63b208d
26eba5a
67d29a4
88d70b5
74216af
b427496
3381e85
bd0b9fa
dec39ba
e7a2ea9
663f383
ca5cf05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
I Need Secrets (or Environment Variables) in my Build | ||
===================================================== | ||
|
||
It may happen that your documentation depends on an authenticated service to be built properly. | ||
In this case, you will require some secrets to access these services. | ||
|
||
Read the Docs provides a way to define environment variables for your project to be used in the build process. | ||
All these variables will be exposed to all the commands executed when building your documentation. | ||
|
||
To define an environment variable, you need to | ||
|
||
#. Go to your project **Admin > Environment Variables** | ||
#. Click on "Add Environment Variable" button | ||
#. Input a ``Name`` and ``Value`` (your secret needed here) | ||
#. Click "Save" button | ||
|
||
.. note:: | ||
|
||
Values will never be exposed to users, even to owners of the project. Once you create an environment variable you won't be able to see its value anymore because of security purposes. | ||
|
||
After adding an environment variable from your project's admin, you can access it from your build process using Python, for example: | ||
|
||
.. code-block:: python | ||
|
||
# conf.py | ||
import os | ||
import requests | ||
|
||
# Access to our custom environment variables | ||
username = os.environ.get('USERNAME') | ||
password = os.environ.get('PASSWORD') | ||
|
||
# Request a username/password protected URL | ||
response = requests.get( | ||
'https://httpbin.org/basic-auth/username/password', | ||
auth=(username, password), | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,13 @@ | |
{% endblock %} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need copy here saying "The value here is not shown for security purposes" or similar. Otherwise it's a weird UI. |
||
{% block project_edit_content %} | ||
|
||
<p> | ||
{% blocktrans trimmed %} | ||
The value of the environment variable is not shown here for sercurity purposes. | ||
{% endblocktrans %} | ||
</p> | ||
|
||
<form method="post" action="{% url 'projects_environmentvariables_delete' project_slug=project.slug environmentvariable_pk=environmentvariable.pk %}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we want to communicate on Environment Variable detail page to the user? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably need to explain that "These environment variables are available to all build steps." This is another place to keep UI prose copy short. |
||
{% csrf_token %} | ||
<input type="submit" value="{% trans "Delete" %}"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 addition.