Skip to content

Commit

Permalink
Rearranging config to not require ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmoulia committed Apr 1, 2015
1 parent a1e8473 commit 087d0c9
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 59 deletions.
12 changes: 0 additions & 12 deletions etc/app.config

This file was deleted.

21 changes: 11 additions & 10 deletions ...roles/switchboard/templates/app.config.j2 → files/app.config
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
%% -*- mode: erlang -*-
[
{switchboard, [{cowboy_port, {{switchboard_http_port}} }
{% if switchboard_google_client_id and switchboard_google_client_secret %}
,
{switchboard, [
{cowboy_port, {{ http_port|default:8080 }}}{% if google_client_id and google_client_secret %},
{oauth_providers,
[{<<"google">>,
[{client_id, <<"{{switchboard_google_client_id}}">> },
{client_secret, <<"{{switchboard_google_client_secret}}">> },
[{client_id, <<"{{ google_client_id }}">> },
{client_secret, <<"{{ google_client_secret }}">> },
{callback_uri, <<"/auth/google/callback">>},
{scope, <<"https://mail.google.com"
" https://www.googleapis.com/auth/userinfo.email"
Expand All @@ -20,9 +19,11 @@
]},

{lager, [{handlers, [{lager_console_backend, info},
{lager_file_backend, [{file, "log/error.log"},
{level, error}]},
{lager_file_backend, [{file, "log/console.log"},
{level, info}]}
{lager_file_backend,
[{file, "{{ log_dir|default:"log" }}/error.log"},
{level, error}]},
{lager_file_backend,
[{file, "{{ log_dir|default:"log" }}/info.log"},
{level, info}]}
]}]}
].
].
5 changes: 5 additions & 0 deletions files/vm.args
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Name of the node
-name switchboard@{{ host|default:"127.0.0.1" }}

## Cookie for distributed erlang
-setcookie {{ cookie|default:"switchboard" }}
14 changes: 1 addition & 13 deletions provisioning/roles/switchboard/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
---
- name: template out vm.args file
template: src=vm.args.j2 dest="{{switchboard_root}}/etc/vm.args" mode=700
tags:
- vmargs
- configure

- name: template out the vars.config file
template: src=vars.config.j2 dest="{{switchboard_root}}/etc/vars.config" mode=700
tags:
- vars
- configure

- name: template out the app.config file
template: src=app.config.j2 dest="{{switchboard_root}}/etc/app.config" mode=700
tags:
- appconfig
- configure
- configure
10 changes: 8 additions & 2 deletions provisioning/roles/switchboard/templates/vars.config.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
%% -*- mode: erlang -*-
{cowboy_port_variable, 8080}.
{logs_dir, "{{switchboard_logs}}"}.
%% Switchboard Config.

{host, "{{ switchboard_host }}"}.
{cookie, "{{ switchboard_cookie }}"}.
{http_port, {{ switchboard_http_port }}}.
{log_dir, "{{ switchboard_logs}}"}.
{google_client_id, "{{ switchboard_google_client_id }}"}.
{google_client_secret, "{{switchboard_google_client_secret }}"}.
19 changes: 0 additions & 19 deletions provisioning/roles/switchboard/templates/vm.args.j2

This file was deleted.

7 changes: 4 additions & 3 deletions relx.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{release, {switchboard, "0.2.1"}, [switchboard]}.
{extended_start_script, true}.
{sys_config, "etc/sys.config"}.
{vm_args, "etc/vm.args"}.
{overlay_vars, "etc/vars.config"}.
%{vm_args, "etc/vm.args"}.
{overlay_vars, "vars.config"}.
{overlay, [{mkdir, "log"},
{template, "etc/app.config", "etc/app.config"}]}.
{template, "files/app.config", "etc/app.config"},
{template, "files/vm.args", "etc/vm.args"}]}.
32 changes: 32 additions & 0 deletions vars.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%% -*- mode: erlang -*-
%% Switchboard Config.
%%
%% Configure switchboard by uncommenting configuration lines and customizing
%% the value.
%%
%% These variables are overlaid against configuration files when the
%% release is built. To refresh the release's configuration, it must
%% be rebuilt.


%% The node name is set to `switchboard@{{ host }}'.
% {host, "127.0.0.1"}.

%% The distributed erlang cookie.
% {cookie, "switchboard"}.

%% The API's HTTP listener port.
% {http_port, 8080}.

%% The directory to save logs under.
% {log_dir, "log"}.


%% Google OAuth: To OAuth using Google, both the `google_client_id' and
%% `google_client_secret' must be set.

%% Google OAuth client id [string].
% {google_client_id, false}.

%% Google OAuth client secret [string].
% {google_client_secret, false}.

0 comments on commit 087d0c9

Please sign in to comment.