I have an app deployed in Heroku , now I got a lot of private repos need to be included in requirements.txt file , I set my GitHub access token and need to put it in Heroku environment variables to be included in requirements.txt file , I already tried a lot to pass it but its not read by the file unless I hard code it inside it , what should be done to make this step as secure as possible?
Asked
Active
Viewed 44 times
0
-
Are your private repository estrictly Python libraries? Are you using some private artifactory like Nexus? – JRichardsz Nov 20 '22 at 02:46
-
they are python projects with setup.py – ashraf khaled Nov 20 '22 at 02:47
-
How are you test them in your localhost? Is for an enterprise or just a poc? – JRichardsz Nov 20 '22 at 02:52
-
for an organization , i test it locally by simply hard coding but this is not secure – ashraf khaled Nov 20 '22 at 02:53
1 Answers
0
Choose a private repository
For an organization and private libraries, you have only one option, no matter the language:
An artifact repository.
- You need to deploy it and configure it
- Push your private libraries.
- Create a user/password and configure them in the machine where yo build your apps. Also you could create another user for your developers. There are roles like write, read only, etc
I advice you:
- How to upload the python packages to Nexus sonartype private repo
- https://www.zepl.com/use-your-private-python-libraries-from-artifactory-in-zepl/
Download the private packages
No matter the cloud (aws, gcp, heroku, etc), you only need to configure the credentials and url of your private repository using the shell or a config file.
Here an example:
.pypirc:
[distutils]
index-servers =
pypi
[pypi]
repository: https://nexus.your.domain/repository/pypi-hosted/
username: nexususername
password: nexuspassword
If you are worried about the credentials, you could do a simple automation to read them from env variable or perform a replacement
password: ${PRIVATE_REPOSITORY_PASSWORD}
password: <PRIVATE_REPOSITORY_PASSWORD>
This generic approach (any private repository & any cloud) should work with github:

JRichardsz
- 14,356
- 6
- 59
- 94