Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
01ace1b3
Commit
01ace1b3
authored
Mar 04, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s3 bucket ploy
parent
e61519a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletions
+41
-1
app/controllers/apis_controller.rb
+4
-1
config/aws-s3-bucket-policy.json
+36
-0
config/settings.yml.example
+1
-0
No files found.
app/controllers/apis_controller.rb
View file @
01ace1b3
...
@@ -19,8 +19,11 @@ class ApisController < ApplicationController
...
@@ -19,8 +19,11 @@ class ApisController < ApplicationController
basename
=
File
.
basename
(
file
.
path
)
basename
=
File
.
basename
(
file
.
path
)
o
=
bucket
.
objects
[
basename
]
o
=
bucket
.
objects
[
basename
]
out
=
o
.
write
(
:file
=>
file
.
path
)
out
=
o
.
write
(
:file
=>
file
.
path
)
# TODO rename file name
s3_file_urls
<<
out
.
url_for
(
:read
,
expireds:
60
).
to_s
# http://soplana.hateblo.jp/entry/%E2%96%A0
s3_file_urls
<<
out
.
url_for
(
:read
).
to_s
end
end
render
json:
{
status:
'OK'
,
urls:
s3_file_urls
}
render
json:
{
status:
'OK'
,
urls:
s3_file_urls
}
...
...
config/aws-s3-bucket-policy.json
0 → 100644
View file @
01ace1b3
{
"Version"
:
"2012-10-17"
,
"Id"
:
"Rendezvous http referer policy"
,
"Statement"
:
[
{
"Sid"
:
"Allow get requests referred by rendezvous"
,
"Effect"
:
"Allow"
,
"Principal"
:
"*"
,
"Action"
:
"s3:GetObject"
,
"Resource"
:
"arn:aws:s3:::rendezvous-uploads/*"
,
"Condition"
:
{
"StringLike"
:
{
"aws:Referer"
:
[
"http://localhost:3000/*"
,
"http://rendezvous.*"
]
}
}
},
{
"Sid"
:
"Explicit deny to ensure requests are allowed only from specific referer."
,
"Effect"
:
"Deny"
,
"Principal"
:
"*"
,
"Action"
:
"s3:GetObject"
,
"Resource"
:
"arn:aws:s3:::rendezvous-uploads/*"
,
"Condition"
:
{
"StringNotLike"
:
{
"aws:Referer"
:
[
"http://localhost:3000/*"
,
"http://rendezvous.*"
]
}
}
}
]
}
config/settings.yml.example
View file @
01ace1b3
...
@@ -6,6 +6,7 @@ defaults: &defaults
...
@@ -6,6 +6,7 @@ defaults: &defaults
google_api:
google_api:
client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
bucket_name: "xxxxxxxxxxxxxx"
development:
development:
<<: *defaults
<<: *defaults
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment