mirror of
https://github.com/we-promise/sure.git
synced 2026-04-17 02:54:10 +00:00
feat: Add parameters in setting to enable/disable auto-sync and define timing
This commit is contained in:
@@ -62,6 +62,16 @@ class Settings::HostingsController < ApplicationController
|
||||
Setting.syncs_include_pending = hosting_params[:syncs_include_pending] == "1"
|
||||
end
|
||||
|
||||
if hosting_params.key?(:auto_sync_enabled)
|
||||
Setting.auto_sync_enabled = hosting_params[:auto_sync_enabled] == "1"
|
||||
AutoSyncScheduler.sync!
|
||||
end
|
||||
|
||||
if hosting_params.key?(:auto_sync_time)
|
||||
Setting.auto_sync_time = hosting_params[:auto_sync_time]
|
||||
AutoSyncScheduler.sync!
|
||||
end
|
||||
|
||||
if hosting_params.key?(:openai_access_token)
|
||||
token_param = hosting_params[:openai_access_token].to_s.strip
|
||||
# Ignore blanks and redaction placeholders to prevent accidental overwrite
|
||||
@@ -103,7 +113,7 @@ class Settings::HostingsController < ApplicationController
|
||||
|
||||
private
|
||||
def hosting_params
|
||||
params.require(:setting).permit(:onboarding_state, :require_email_confirmation, :brand_fetch_client_id, :twelve_data_api_key, :openai_access_token, :openai_uri_base, :openai_model, :openai_json_mode, :exchange_rate_provider, :securities_provider, :syncs_include_pending)
|
||||
params.require(:setting).permit(:onboarding_state, :require_email_confirmation, :brand_fetch_client_id, :twelve_data_api_key, :openai_access_token, :openai_uri_base, :openai_model, :openai_json_mode, :exchange_rate_provider, :securities_provider, :syncs_include_pending, :auto_sync_enabled, :auto_sync_time)
|
||||
end
|
||||
|
||||
def ensure_admin
|
||||
|
||||
Reference in New Issue
Block a user