Skip to content

Commit

Permalink
Add regex allowed domain
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau committed Oct 22, 2024
1 parent 6b35ad6 commit 1963f9d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
##
* add regex support for domain

## v4.0.x-20241015

* Big update the project, use native steam version (not a fork anymore)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ you can allow specific domain like this:
ALLOWED_HOSTS=foo1.exemple.org,10.10.10.82:3000,localhost:3000
```

You can also add regex

```
ALLOWED_HOSTS_REGEX=/10\.0\.[012]\.\d+/
```



### LOCOMOTIVE_ENABLE_REGISTRATION

```
Expand Down
5 changes: 5 additions & 0 deletions shopinvader/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,9 @@
config.hosts += ENV["ALLOWED_HOSTS"].split(",")
end

allowed_hosts_regex = ENV.fetch('ALLOWED_HOSTS_REGEX', '').split(',')
allowed_hosts_regex.each do |regex|
config.hosts << Regexp.new(regex.strip)
end

end

0 comments on commit 1963f9d

Please sign in to comment.