Skip to content
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

Added proxy support #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ The following regions are recognized:
* `us-west-1`
* `us-west-2`

### Proxy

You can specify the proxy server to use for deployment
your `project.clj` file:
```clojure
:aws {:beanstalk {:proxy-host "proxy.host"
:proxy-port 1080}}
```

## Trouble-Shooting

Expand Down
12 changes: 10 additions & 2 deletions src/leiningen/beanstalk/aws.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
java.text.SimpleDateFormat
java.util.Date
[java.util.logging Logger Level]
com.amazonaws.ClientConfiguration
com.amazonaws.auth.BasicAWSCredentials
com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient
com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionSetting
Expand Down Expand Up @@ -78,17 +79,24 @@
(when-not (.doesBucketExist client bucket)
(.createBucket client bucket)))

(defn- client-configuration [project]
"Create an instance of ClientConfiguration with the proxies set, if available"
(let [client-config (ClientConfiguration.)]
(when (-> project :aws :beanstalk :proxy-host) (.setProxyHost client-config (-> project :aws :beanstalk :proxy-host)))
(when (-> project :aws :beanstalk :proxy-port) (.setProxyPort client-config (-> project :aws :beanstalk :proxy-port)))
client-config))

(defn s3-upload-file [project filepath]
(let [bucket (s3-bucket-name project)
file (io/file filepath)]
(doto (AmazonS3Client. (credentials project))
(doto (AmazonS3Client. (credentials project) (client-configuration project))
(.setEndpoint (project-endpoint project s3-endpoints))
(create-bucket bucket)
(.putObject bucket (.getName file) file))
(println "Uploaded" (.getName file) "to S3 Bucket")))

(defn- beanstalk-client [project]
(doto (AWSElasticBeanstalkClient. (credentials project))
(doto (AWSElasticBeanstalkClient. (credentials project) (client-configuration project))
(.setEndpoint (project-endpoint project beanstalk-endpoints))))

(defn create-app-version
Expand Down