Skip to content

Commit ef98fe8

Browse files
authored
Merge pull request #11 from rainlab-inc/configuration
Configuration
2 parents 6decfa0 + 9f90578 commit ef98fe8

File tree

8 files changed

+33
-1
lines changed

8 files changed

+33
-1
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ REPLACE_OS_VARS=true
99
MIX_ENV=prod
1010
ADMIN_USERNAME=root
1111
ADMIN_PASSWORD=toor
12-
LOG_ROOM_USAGE=true
12+
LOG_ROOM_USAGE=true
13+
APP_IMAGE_URL=http://localhost:4000/images/app_image.jpg

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Here's some explanation of some environment values.
6565

6666
`LOG_ROOM_USAGE` let the application create room usage logs. Default: `false`
6767

68+
`APP_IMAGE_URL` You can setup an header image for your application. If not, we're going to use this [photo](https://unsplash.com/photos/qCjolcMFaLI) by [Daniel DiNuzzo @ddinuzzo](https://unsplash.com/@ddinuzzo) on [Unsplash](https://unsplash.com/).
69+
6870
1. Update your database settings and persistent volume paths in `docker-compose.yml` file. You can keep track of bussiest days of the week and time of the day for the room usage.
6971

7072
1. There are two ways to have the docker image:

assets/static/images/app_image.jpg

1.65 MB
Loading

config/config.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config :phoenix, :json_library, Jason
2828

2929
config :coliving,
3030
app_title: System.get_env("APP_TITLE") || "CoThings",
31+
app_image_url: System.get_env("APP_IMAGE_URL") || "http://localhost:4000/images/app_image.jpg",
3132
usage_logging_enabled: System.get_env("LOG_ROOM_USAGE") || false
3233

3334
# Import environment specific config. This must remain at the bottom

config/releases.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ config :coliving, ColivingWeb.Endpoint,
3737

3838
config :coliving,
3939
app_title: System.get_env("APP_TITLE") || "CoThings",
40+
app_image_url: System.get_env("APP_IMAGE_URL") || "https://" + System.get_env("HOST") + "/images/app_image.jpg",
4041
usage_logging_enabled: toBool.(System.get_env("LOG_ROOM_USAGE"), false)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
defmodule ColivingWeb.ConfigController do
2+
use ColivingWeb, :controller
3+
4+
def index(conn, _params) do
5+
data = %{
6+
"app" => %{
7+
"title" => Application.get_env(:coliving, :app_title),
8+
"image_url" => Application.get_env(:coliving, :app_image_url)
9+
}
10+
}
11+
render(conn, "config.json", data: data)
12+
end
13+
14+
end

lib/coliving_web/router.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ defmodule ColivingWeb.Router do
2121
resources "/rooms", RoomController
2222
end
2323

24+
scope "/", ColivingWeb do
25+
pipe_through :api
26+
get "/config.json", ConfigController, :index
27+
end
28+
2429
scope "/session", ColivingWeb do
2530
pipe_through :browser
2631

lib/coliving_web/views/config_view.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
defmodule ColivingWeb.ConfigView do
2+
use ColivingWeb, :view
3+
4+
def render("config.json", %{data: data }) do
5+
data
6+
end
7+
8+
end

0 commit comments

Comments
 (0)