Sha256: 2c0572fb29ce949e0a9b83bcf4f641f82b41301d18064b7111fbbd98f50d097f

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Motor
  module Configs
    FILE_PATH = 'config/motor.yml'
    SYNC_API_PATH = '/motor_configs_sync'
    SYNC_ACCESS_KEY = ENV.fetch('MOTOR_SYNC_API_KEY', '')
    WORKDIR_FILE_NAME = 'motor-admin.yml'

    module_function

    def clear
      Motor::Resource.destroy_all
      Motor::Alert.destroy_all
      Motor::Query.destroy_all
      Motor::Dashboard.destroy_all
      Motor::Form.destroy_all
      Motor::ApiConfig.destroy_all
      Motor::Config.destroy_all
    end

    # @return [String]
    def file_path
      if defined?(MotorAdmin::Application)
        [ENV['WORKDIR'], WORKDIR_FILE_NAME].compact.join('/')
      else
        Rails.root.join(FILE_PATH).to_s
      end
    end
  end
end

require_relative 'configs/load_from_cache'
require_relative 'configs/build_ui_app_tag'
require_relative 'configs/build_configs_hash'
require_relative 'configs/write_to_file'
require_relative 'configs/sync_from_hash'
require_relative 'configs/sync_from_file'
require_relative 'configs/sync_with_remote'

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
motor-admin-cstham8-0.4.35 lib/motor/configs.rb
motor-admin-cstham8-0.4.34 lib/motor/configs.rb
motor-admin-cstham8-0.4.33 lib/motor/configs.rb
motor-admin-cstham8-0.4.32 lib/motor/configs.rb
motor-admin-cstham8-0.4.31 lib/motor/configs.rb
motor-admin-cstham8-0.4.30 lib/motor/configs.rb
motor-admin-cstham8-0.4.29 lib/motor/configs.rb
motor-admin-cstham8-0.4.28 lib/motor/configs.rb
motor-admin-cstham8-0.4.27 lib/motor/configs.rb