Skip to content

Commit

Permalink
Merge branch 'master' into chore/227-rails-and-gems-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
oscgonfer authored Sep 19, 2023
2 parents 54d83e9 + 94e3688 commit 167f2e4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PopulateDeviceArchivedAtColumn < ActiveRecord::Migration[6.0]
def change
execute %{
UPDATE devices
SET archived_at = NOW()
WHERE workflow_state = 'archived'
}
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
t.string "state"
t.string "device_token"
t.jsonb "hardware_info"
t.datetime "notify_stopped_publishing_timestamp", default: "2019-01-16 16:19:35"
t.datetime "notify_low_battery_timestamp", default: "2019-01-16 16:19:35"
t.datetime "notify_stopped_publishing_timestamp", default: "2019-01-21 16:07:41"
t.datetime "notify_low_battery_timestamp", default: "2019-01-21 16:07:41"
t.boolean "notify_low_battery", default: false
t.boolean "notify_stopped_publishing", default: false
t.boolean "is_private", default: false
Expand Down
3 changes: 2 additions & 1 deletion env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ REDIS_STORE=redis://redis:6379/3
MQTT_HOST=mqtt
#MQTT_CLEAN_SESSION=true
#MQTT_CLIENT_ID=some_id

#MQTT_PORT=port
#MQTT_SSL=false
aws_secret_key=123

# kairos Dockerized
Expand Down
8 changes: 7 additions & 1 deletion lib/tasks/mqtt_subscriber.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ namespace :mqtt do
mqtt_clean_session = ENV.has_key?('MQTT_CLEAN_SESSION') ? ENV['MQTT_CLEAN_SESSION'] == "true" : true
mqtt_client_id = ENV.has_key?('MQTT_CLIENT_ID') ? ENV['MQTT_CLIENT_ID'] : nil
mqtt_host = ENV.has_key?('MQTT_HOST') ? ENV['MQTT_HOST'] : 'mqtt'
mqtt_port = ENV.has_key?('MQTT_PORT') ? ENV['MQTT_PORT'] : 1883
mqtt_ssl = ENV.has_key?('MQTT_SSL') ? ENV['MQTT_SSL'] : false

mqtt_log.info('MQTT TASK STARTING')
mqtt_log.info("clean_session: #{mqtt_clean_session}")
mqtt_log.info("client_id: #{mqtt_client_id}")
mqtt_log.info("host: #{mqtt_host}")
mqtt_log.info("port: #{mqtt_port}")
mqtt_log.info("ssl: #{mqtt_ssl}")

begin
MQTT::Client.connect(
:host => mqtt_host,
:port => mqtt_port,
:clean_session => mqtt_clean_session,
:client_id => mqtt_client_id
:client_id => mqtt_client_id,
:ssl => mqtt_ssl
) do |client|

mqtt_log.info "Connected to #{client.host}"
Expand Down

0 comments on commit 167f2e4

Please sign in to comment.