Skip to content

Commit

Permalink
fix token
Browse files Browse the repository at this point in the history
  • Loading branch information
hrl20 committed Jan 23, 2025
1 parent 753047c commit 4cb8350
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions pkg/models/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ func LoadPluginSettings(source backend.DataSourceInstanceSettings) (*PluginSetti
if err != nil {
return nil, fmt.Errorf("could not unmarshal PluginSettings json: %w", err)
}

settings.Secrets = loadSecretPluginSettings(source.DecryptedSecureJSONData)

return &settings, nil
}

func loadSecretPluginSettings(source map[string]string) *SecretPluginSettings {
return &SecretPluginSettings{
MotherDuckToken: source["motherduckToken"],
MotherDuckToken: source["motherDuckToken"],
}
}
5 changes: 3 additions & 2 deletions pkg/plugin/duckdb_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ func (d *DuckDBDriver) Connect(ctx context.Context, settings backend.DataSourceI
}

// User defined init queries.
initSqls := strings.Split(config.InitSql, ";")
bootQueries = append(bootQueries, initSqls...)
if strings.TrimSpace(config.InitSql) != "" {
bootQueries = append(bootQueries, config.InitSql)
}

for _, query := range bootQueries {
_, err = execer.ExecContext(context.Background(), query, nil)
Expand Down
10 changes: 4 additions & 6 deletions src/components/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ export function ConfigEditor(props: Props) {
onOptionsChange({
...options,
secureJsonFields: {
...options.secureJsonFields,
motherDuckToken: false,
},
secureJsonData: {
...options.secureJsonData,
motherDuckToken: '',
},
});
Expand All @@ -61,18 +59,18 @@ export function ConfigEditor(props: Props) {
id="config-editor-path"
onChange={onPathChange}
value={jsonData.path}
placeholder="Enter the path to the duckdb file, or :memory: for in-memory database."
placeholder="Enter the path to the duckdb file, or leave blank for in-memory database."
width={40}
/>
</InlineField>
<InlineField label="Init SQL" labelWidth={18} interactive
<InlineField label="Init SQL" labelWidth={20} interactive
tooltip={'(Optional) SQL to run when connection is established'}>
<TextArea
id="config-editor-init-sql"
onChange={onInitSqlChange}
value={jsonData.initSql || ''}
placeholder="INSTALL 'httpfs'; LOAD 'httpfs';"
width={40}
placeholder="e.g. INSTALL 'httpfs'; LOAD 'httpfs';"
width={60}
rows={5}
/>
</InlineField>
Expand Down

0 comments on commit 4cb8350

Please sign in to comment.