61 lines
2.6 KiB
Plaintext
61 lines
2.6 KiB
Plaintext
<% content_for :title, "Settings" %>
|
|
|
|
<div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
|
|
<!-- Header -->
|
|
<div class="mb-8">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-gray-900">Settings</h1>
|
|
<p class="mt-2 text-gray-600">Manage system configuration and API keys</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Settings Form -->
|
|
<div class="bg-white shadow sm:rounded-lg">
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">API Configuration</h3>
|
|
|
|
<!-- ipapi.is API Key -->
|
|
<div class="mb-6">
|
|
<%= form_with url: settings_path, method: :patch, class: "space-y-4" do |f| %>
|
|
<%= hidden_field_tag :key, 'ipapi_key' %>
|
|
|
|
<div>
|
|
<label for="ipapi_key" class="block text-sm font-medium text-gray-700">
|
|
ipapi.is API Key
|
|
</label>
|
|
<div class="mt-1 flex rounded-md shadow-sm">
|
|
<%= text_field_tag :value,
|
|
@settings['ipapi_key']&.value || ENV['IPAPI_KEY'],
|
|
class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-md border-gray-300 focus:ring-blue-500 focus:border-blue-500 sm:text-sm",
|
|
placeholder: "Enter your ipapi.is API key" %>
|
|
<%= f.submit "Update", class: "ml-3 inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %>
|
|
</div>
|
|
<p class="mt-2 text-sm text-gray-500">
|
|
<% if @settings['ipapi_key']&.value.present? %>
|
|
<span class="text-green-600">✓ Configured in database</span>
|
|
<% elsif ENV['IPAPI_KEY'].present? %>
|
|
<span class="text-yellow-600">Using environment variable (IPAPI_KEY)</span>
|
|
<% else %>
|
|
<span class="text-red-600">ipapi.is not active</span>
|
|
<% end %>
|
|
</p>
|
|
<p class="mt-1 text-xs text-gray-400">
|
|
Get your API key from <a href="https://ipapi.is/" target="_blank" class="text-blue-600 hover:text-blue-800">ipapi.is</a>
|
|
</p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Future Settings Section -->
|
|
<div class="mt-6 bg-gray-50 shadow sm:rounded-lg">
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-2">Additional Settings</h3>
|
|
<p class="text-sm text-gray-500">More configuration options will be added here as needed.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|