-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dummy Space model. Set current space based on subdomain
- Loading branch information
Showing
8 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Space | ||
include ActiveModel::Model | ||
|
||
attr_accessor :id, :name, :logo | ||
|
||
def self.find(id) | ||
return nil if id.nil? | ||
if TeSS::Config.spaces&.key?(id) | ||
self.new(TeSS::Config.spaces[id].merge(id: id)) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Rails.application.config.hosts << /.*\.mytess\.training(\:\d+)?/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Development | ||
|
||
## Simulating subdomains | ||
|
||
A multi-space enabled TeSS will set the current space based on the subdomain of the incoming request. | ||
|
||
To allow your local development server to respond to requests with a subdomain, | ||
edit your hosts file (`/etc/hosts` on Linux) to include something like the following, e.g.: | ||
|
||
``` | ||
127.0.0.1 plants.mytess.training | ||
127.0.0.1 astro.mytess.training | ||
127.0.0.1 whatever.mytess.training | ||
``` | ||
|
||
This will ensure that if you visit e.g. plants.mytess.training, your browser will route it to your local development server | ||
(you may need to restart your browser after changing the hosts file). | ||
|
||
Edit `config/hosts.rb` to ensure your Rails application accepts requests to the hosts provided above. | ||
|
||
## Configuring spaces | ||
|
||
Edit `tess.yml` to define spaces, e.g.: | ||
|
||
``` | ||
spaces: | ||
plants: | ||
name: TeSS Plants Community | ||
astro: | ||
name: TeSS Space Community | ||
whatever: | ||
name: The Whatever Space | ||
``` | ||
|
||
(Your server will need to be restarted after changing this file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters