Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mimolabs/mimo-api
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmorley committed Jun 12, 2018
2 parents 4ca5e72 + c32744b commit dd4945d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ COPY . /myapp
COPY ./build/puma.rb /myapp/config/puma.rb

EXPOSE 8080
ENTRYPOINT ["./docker-entrypoint.sh"]
9 changes: 6 additions & 3 deletions app/lib/unifi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def login_unifi_client(client_mac, minutes=60, logout=false)

conn = Faraday.new(
url: host + "/api/s/#{metadata['unifi_site_name']}/cmd/stamgr",
ssl: { verify: false }
ssl: { verify: false },
request: { timeout: 2, open_timeout: 2 }
)

cmd = logout ? 'unauthorize-guest' : 'authorize-guest'
Expand Down Expand Up @@ -346,7 +347,8 @@ def create_guest_settings
def get_unifi(path, opts={}, cookies=nil)
conn = Faraday.new(
url: host + "/api#{path}",
ssl: { verify: false }
ssl: { verify: false },
request: { timeout: 2, open_timeout: 2 }
)
response = conn.get do |req|
req.body = opts.to_json if opts.present?
Expand All @@ -370,7 +372,8 @@ def get_unifi(path, opts={}, cookies=nil)
def post_unifi(path, opts={}, cookies=nil)
conn = Faraday.new(
url: host + "/api#{path}",
ssl: { verify: false }
ssl: { verify: false },
request: { timeout: 2, open_timeout: 2 }
)
resp = conn.post do |req|
req.body = opts.to_json if opts.present?
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UserMailer < ApplicationMailer

def new_code
@user = params[:user]
@url = "#{ENV['MIMO_DASHBOARD_URL']}/wizard/start?code=#{generate_code}"
@url = "#{ENV['MIMO_API_URL']}/wizard/start?code=#{generate_code}"
mail(to: @user.email, subject: 'New setup code!')
end

Expand Down
12 changes: 12 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -e

if [ -f tmp/pids/server.pid ]; then
rm tmp/pids/server.pid
fi

bundle exec rake db:migrate 2>/dev/null || bundle exec rake db:setup
# bundle exec rake assets:precompile
# bundle exec rake production:bootstrap

exec bundle exec "$@"

0 comments on commit dd4945d

Please sign in to comment.