configure-s3-website 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -8
- data/changelog.md +4 -0
- data/lib/configure-s3-website/config_source/file_config_source.rb +12 -4
- data/lib/configure-s3-website/s3_client.rb +12 -5
- data/lib/configure-s3-website/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33ce4f35ab6af0df19dc186cd931a5cc70d96e4
|
4
|
+
data.tar.gz: 86ef41e2572b387d6ea1666b030135e5179341d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd81ad8e3e2d4304ffd8cd9231671e9f428fb380064ba60b1624b4401600abf5ec1b4480befb8d8f48acd8de737a5a6dbb3e8e2de7dfda552c606533568c2288
|
7
|
+
data.tar.gz: b3654371cf9a0e2ec151c94af155577ec438421714e179786f5e956b1c57010d63bf8228a688d4cf39cabe25aab5df3723c4e28ae9aa4b938b5211841b9ad33e
|
data/README.md
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/laurilehmijoki/configure-s3-website.png)](http://travis-ci.org/laurilehmijoki/configure-s3-website)
|
4
4
|
[![Gem Version](https://fury-badge.herokuapp.com/rb/configure-s3-website.png)](http://badge.fury.io/rb/configure-s3-website)
|
5
5
|
|
6
|
-
Configure an AWS S3 bucket to function as a website
|
7
|
-
command-line interface.
|
6
|
+
Configure an AWS S3 bucket to function as a website easily from a command-line interface.
|
8
7
|
|
9
8
|
The bucket may or may not exist. If the bucket does not exist,
|
10
9
|
`configure-s3-website` will create it.
|
@@ -17,7 +16,14 @@ For deploying websites to S3, consider using [s3_website](https://github.com/lau
|
|
17
16
|
|
18
17
|
## Usage
|
19
18
|
|
20
|
-
Create a file that contains the S3
|
19
|
+
Create a file that contains the name of your AWS profile with access to S3 and the name of the bucket:
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
profile: name-of-your-aws-profile-with-access
|
23
|
+
s3_bucket: name-of-your-bucket
|
24
|
+
```
|
25
|
+
|
26
|
+
**or** create a file that contains the S3 credentials and the name of the bucket:
|
21
27
|
|
22
28
|
```yaml
|
23
29
|
s3_id: your-aws-access-key
|
@@ -70,11 +76,11 @@ file. For example:
|
|
70
76
|
```yaml
|
71
77
|
cloudfront_distribution_config:
|
72
78
|
default_cache_behavior:
|
73
|
-
|
79
|
+
min_ttl: 600
|
74
80
|
aliases:
|
75
81
|
quantity: 1
|
76
82
|
items:
|
77
|
-
|
83
|
+
- your.domain.net
|
78
84
|
```
|
79
85
|
|
80
86
|
See the section below for more information about the valid values of the
|
@@ -94,12 +100,12 @@ Let's say your config file contains the following fragment:
|
|
94
100
|
cloudfront_distribution_id: AXSAXSSE134
|
95
101
|
cloudfront_distribution_config:
|
96
102
|
default_cache_behavior:
|
97
|
-
|
103
|
+
min_ttl: 600
|
98
104
|
default_root_object: index.json
|
99
105
|
```
|
100
106
|
|
101
107
|
When you invoke `configure-s3-website`, it will overwrite the default value of
|
102
|
-
*default_cache_behavior's* *
|
108
|
+
*default_cache_behavior's* *min_ttl* as well as the default value of
|
103
109
|
*default_root_object* setting in the [default distribution configs](#default-distribution-configs).
|
104
110
|
|
105
111
|
This gem generates `<DistributionConfig>` of the CloudFront REST API. For
|
@@ -151,7 +157,7 @@ Type](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/Distributi
|
|
151
157
|
}
|
152
158
|
},
|
153
159
|
'viewer_protocol_policy' => 'allow-all',
|
154
|
-
'
|
160
|
+
'min_ttl' => '86400'
|
155
161
|
},
|
156
162
|
'cache_behaviors' => {
|
157
163
|
'quantity' => '0'
|
data/changelog.md
CHANGED
@@ -20,6 +20,10 @@ module ConfigureS3Website
|
|
20
20
|
@config['s3_secret']
|
21
21
|
end
|
22
22
|
|
23
|
+
def profile
|
24
|
+
@config['profile']
|
25
|
+
end
|
26
|
+
|
23
27
|
def s3_bucket_name
|
24
28
|
@config['s3_bucket']
|
25
29
|
end
|
@@ -74,10 +78,14 @@ module ConfigureS3Website
|
|
74
78
|
end
|
75
79
|
|
76
80
|
def self.validate_config(config, yaml_file_path)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
+
# make sure the bucket name is configured at a minimum
|
82
|
+
if not config.keys.include?'s3_bucket'
|
83
|
+
raise "File #{yaml_file_path} does not contain the required key 's3_bucket'"
|
84
|
+
end
|
85
|
+
|
86
|
+
# check that either s3_id or profile is configured
|
87
|
+
if not (config.keys.include?'s3_id' or config.keys.include?'profile')
|
88
|
+
raise "File #{yaml_file_path} does not contain either 's3_id' or 'profile'"
|
81
89
|
end
|
82
90
|
end
|
83
91
|
end
|
@@ -21,11 +21,18 @@ module ConfigureS3Website
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def self.s3(config_source)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
if config_source.s3_access_key_id
|
25
|
+
Aws::S3::Client.new(
|
26
|
+
region: config_source.s3_endpoint,
|
27
|
+
access_key_id: config_source.s3_access_key_id,
|
28
|
+
secret_access_key: config_source.s3_secret_access_key
|
29
|
+
)
|
30
|
+
else
|
31
|
+
Aws::S3::Client.new(
|
32
|
+
region: config_source.s3_endpoint,
|
33
|
+
profile: config_source.profile,
|
34
|
+
)
|
35
|
+
end
|
29
36
|
end
|
30
37
|
|
31
38
|
def self.enable_website_configuration(config_source)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configure-s3-website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lauri Lehmijoki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|