Method: RedactorAws::Aws#policy

Defined in:
app/models/redactor_aws/aws.rb

#policyObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/redactor_aws/aws.rb', line 14

def policy
  policy_json="{'expiration': '2020-01-01T00:00:00Z',
    'conditions': [ 
      {'bucket': '#{@bucket}'}, 
      ['starts-with', '$key', ''],
      {'acl': 'public-read'},
      {'success_action_redirect': '#{@success_path}'},
      ['starts-with', '$Content-Type', ''],
      ['content-length-range', 0, 1048576]
    ]
  }"

  Base64.encode64(policy_json).gsub("\n","")
end