mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Revise seed config
No longer use `Config` to store the seed config. Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
+7
-8
@@ -1,21 +1,20 @@
|
||||
import type { Config } from '@app/config';
|
||||
export interface Host {
|
||||
host: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
export async function get(
|
||||
path: string,
|
||||
params: Record<string, any>,
|
||||
config: Config
|
||||
api: Host
|
||||
): Promise<any> {
|
||||
if (! config.seed.api.host) {
|
||||
throw new Error("Seed host unavailable");
|
||||
}
|
||||
|
||||
const query: Record<string, string> = {};
|
||||
for (const [key, val] of Object.entries(params)) {
|
||||
query[key] = val.toString();
|
||||
}
|
||||
|
||||
const base = config.seed.api.host;
|
||||
const port = config.seed.api.port;
|
||||
const base = api.host;
|
||||
const port = api.port;
|
||||
const search = new URLSearchParams(query).toString();
|
||||
// Allow using the functionality with local runned http-api
|
||||
const isLocalhost = /^0.0.0.0$/.test(base);
|
||||
|
||||
Reference in New Issue
Block a user