Merge pull request #14 from duckdb/jray/require-allow-unsigned-for-remote-url-setting
require allow_unsigned for ui_remote_url setting
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <duckdb/main/client_context.hpp>
|
|
||||||
#include <duckdb/common/exception.hpp>
|
#include <duckdb/common/exception.hpp>
|
||||||
|
#include <duckdb/main/client_context.hpp>
|
||||||
|
|
||||||
#define UI_LOCAL_PORT_SETTING_NAME "ui_local_port"
|
#define UI_LOCAL_PORT_SETTING_NAME "ui_local_port"
|
||||||
|
#define UI_LOCAL_PORT_SETTING_DEFAULT 4213
|
||||||
#define UI_REMOTE_URL_SETTING_NAME "ui_remote_url"
|
#define UI_REMOTE_URL_SETTING_NAME "ui_remote_url"
|
||||||
|
#define UI_REMOTE_URL_SETTING_DEFAULT "https://ui.duckdb.org"
|
||||||
#define UI_POLLING_INTERVAL_SETTING_NAME "ui_polling_interval"
|
#define UI_POLLING_INTERVAL_SETTING_NAME "ui_polling_interval"
|
||||||
|
#define UI_POLLING_INTERVAL_SETTING_DEFAULT 284
|
||||||
|
|
||||||
namespace duckdb {
|
namespace duckdb {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
|
#include <duckdb.hpp>
|
||||||
|
|
||||||
namespace duckdb {
|
namespace duckdb {
|
||||||
|
|
||||||
std::string GetRemoteUrl(const ClientContext &context) {
|
std::string GetRemoteUrl(const ClientContext &context) {
|
||||||
|
if (!context.db->config.options.allow_unsigned_extensions) {
|
||||||
|
return UI_REMOTE_URL_SETTING_DEFAULT;
|
||||||
|
}
|
||||||
return internal::GetSetting<std::string>(context, UI_REMOTE_URL_SETTING_NAME);
|
return internal::GetSetting<std::string>(context, UI_REMOTE_URL_SETTING_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,15 +76,16 @@ static void LoadInternal(DatabaseInstance &instance) {
|
|||||||
|
|
||||||
auto &config = DBConfig::GetConfig(instance);
|
auto &config = DBConfig::GetConfig(instance);
|
||||||
{
|
{
|
||||||
auto default_port = GetEnvOrDefaultInt(UI_LOCAL_PORT_SETTING_NAME, 4213);
|
auto default_port = GetEnvOrDefaultInt(UI_LOCAL_PORT_SETTING_NAME,
|
||||||
|
UI_LOCAL_PORT_SETTING_DEFAULT);
|
||||||
config.AddExtensionOption(
|
config.AddExtensionOption(
|
||||||
UI_LOCAL_PORT_SETTING_NAME, "Local port on which the UI server listens",
|
UI_LOCAL_PORT_SETTING_NAME, "Local port on which the UI server listens",
|
||||||
LogicalType::USMALLINT, Value::USMALLINT(default_port));
|
LogicalType::USMALLINT, Value::USMALLINT(default_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto def =
|
auto def = GetEnvOrDefault(UI_REMOTE_URL_SETTING_NAME,
|
||||||
GetEnvOrDefault(UI_REMOTE_URL_SETTING_NAME, "https://ui.duckdb.org");
|
UI_REMOTE_URL_SETTING_DEFAULT);
|
||||||
config.AddExtensionOption(
|
config.AddExtensionOption(
|
||||||
UI_REMOTE_URL_SETTING_NAME,
|
UI_REMOTE_URL_SETTING_NAME,
|
||||||
"Remote URL to which the UI server forwards GET requests",
|
"Remote URL to which the UI server forwards GET requests",
|
||||||
@@ -92,7 +93,8 @@ static void LoadInternal(DatabaseInstance &instance) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto def = GetEnvOrDefaultInt(UI_POLLING_INTERVAL_SETTING_NAME, 284);
|
auto def = GetEnvOrDefaultInt(UI_POLLING_INTERVAL_SETTING_NAME,
|
||||||
|
UI_POLLING_INTERVAL_SETTING_DEFAULT);
|
||||||
config.AddExtensionOption(
|
config.AddExtensionOption(
|
||||||
UI_POLLING_INTERVAL_SETTING_NAME,
|
UI_POLLING_INTERVAL_SETTING_NAME,
|
||||||
"Period of time between UI polling requests (in ms)",
|
"Period of time between UI polling requests (in ms)",
|
||||||
|
|||||||
Reference in New Issue
Block a user