Skip to content

Commit 49c5d52

Browse files
committed
Merge pull request #6 from ryanbrainard/support-env-dir
Remove user-env-compile dependency
2 parents bb727f6 + f1ae269 commit 49c5d52

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

README.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ and instead only set it on the app where you push your code & which runs the bui
1818
Requirements
1919
------------
2020

21-
The app must have `user-env-compile` enabled for the buildpack to have access to config vars when building.
22-
23-
heroku labs:enable user-env-compile -a myapp
24-
25-
[Read more aobut user-env-compile.](https://devcenter.heroku.com/articles/labs-user-env-compile)
26-
27-
You'll also need to make a Github authorization token. Here's the `curl` command you can use.
21+
You'll need to make a Github authorization token. Here's the `curl` command you can use.
2822

2923
```console
3024
$ curl -u 'my-read-only-user' -d '{"scopes":["repo"],"note":"GITHUB_AUTH_TOKEN for Heroku deplyoments","note_url":"https://github.com/timshadel/heroku-buildpack-github-netrc"}' https://api.github.com/authorizations # Github API call
@@ -60,11 +54,10 @@ Usage
6054

6155
Example usage:
6256

63-
$ heroku create --stack cedar --buildpack http://github.com/fs-webdev/heroku-buildpack-netrc.git
57+
$ heroku create --buildpack https://github.com/fs-webdev/heroku-buildpack-netrc.git
6458

65-
Enable config vars to be visible during buildpack execution, and set the token.
59+
Set the token.
6660

67-
$ heroku labs:enable user-env-compile
6861
$ heroku config:set GITHUB_AUTH_TOKEN=<my-read-only-token>
6962

7063
Deploy your app.
@@ -82,4 +75,4 @@ $ git push heroku master # push your changes to Heroku
8275
Github User: my-read-only-user
8376
Authorization: GITHUB_AUTH_TOKEN for Heroku deplyoments (private repo access)
8477
Organizations: my-org, another-org
85-
```
78+
```

bin/compile

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ require "#{File.join(File.dirname(__FILE__), '..', 'lib', 'github')}"
66

77
build_dir = ARGV[0]
88
cache_dir = ARGV[1]
9-
github_token = ENV['GITHUB_AUTH_TOKEN']
9+
env_dir = ARGV[2]
10+
11+
github_token = if env_dir
12+
token_file = File.join(env_dir, 'GITHUB_AUTH_TOKEN')
13+
File.open(token_file, &:read) if File.exist? token_file
14+
else
15+
# Legacy user-env-compile support
16+
# TODO: Remove once deprecation is complete
17+
ENV['GITHUB_AUTH_TOKEN']
18+
end
1019

1120
if github_token.nil?
1221
puts " !!!! GITHUB_AUTH_TOKEN not set"
@@ -44,6 +53,6 @@ if valid_login? github_token
4453
# Print out user information
4554
puts user_block(github_token)
4655
else
47-
puts " !!!! No valid Github user found with GITHUB_AUTH_TOKEN: '#{ENV['GITHUB_AUTH_TOKEN']}'"
56+
puts " !!!! No valid Github user found with GITHUB_AUTH_TOKEN: '#{github_token}'"
4857
exit 1
4958
end

0 commit comments

Comments
 (0)