Commit 4fb9662
committed
Move override application logic to configuration class
While the normal expected use case for an override is to apply it to a request, there are uses cases where we might want to apply an override to a non-request context. For example, we have a script that runs outside of the main rails app to generate some static configs we copy/paste into some static files.
It would look something like this:
```
_, static_csp_policy = SecureHeaders::CSP.make_header(SecureHeaders::Configuration.get.apply_overrides(:static_file_policy).csp, nil)
...
%q(<meta http-equiv="Content-Security-Policy" content="#{static_csp+policy"})
```1 parent 6ac2f46 commit 4fb9662
2 files changed
+15
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
175 | 171 | | |
176 | 172 | | |
177 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
170 | 182 | | |
171 | 183 | | |
172 | 184 | | |
| |||
0 commit comments