Skip to content
This repository was archived by the owner on Aug 22, 2019. It is now read-only.

Commit fd8debb

Browse files
committed
docker to readme and OPTIONS to api proxy
1 parent 77e6bc6 commit fd8debb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ AIR_TABLE_API_KEY=<your_key> ./airtable-api-proxy
1010
```
1111

1212
## Docker
13-
WIP.
13+
```bash
14+
docker run -p 4242:4242 hookactions/airtable-api-proxy
15+
```

main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ type transport struct {
1919
apiKey string
2020
}
2121

22-
func(t *transport) RoundTrip(r *http.Request) (*http.Response, error) {
23-
log.Printf("Sending request to %q", r.URL.String())
22+
func (t *transport) RoundTrip(r *http.Request) (*http.Response, error) {
23+
log.Printf("Sending request, %s %s", r.Method, r.URL.String())
24+
2425
r.Host = r.URL.Host
2526
r.Header.Set("Authorization", fmt.Sprintf("Bearer %s", t.apiKey))
2627
r.Header.Del("X-Forwarded-For")
28+
2729
return http.DefaultTransport.RoundTrip(r)
2830
}
2931

@@ -48,7 +50,7 @@ func main() {
4850
airTableApiKey := os.Getenv("AIR_TABLE_API_KEY")
4951

5052
router := mux.NewRouter()
51-
router.HandleFunc("/{version}/{app}/{resource}", newProxyHandler(airTableApiKey)).Methods("POST")
53+
router.HandleFunc("/{version}/{app}/{resource}", newProxyHandler(airTableApiKey)).Methods("POST", "OPTIONS")
5254

5355
srv := &http.Server{
5456
Handler: router,

0 commit comments

Comments
 (0)