tweak(git): Move proxy url definition into config files

We'll likely want to host our own proxy. Self-hosters likewise may have
their own, but it's convenient to use isomorphic-git's for development.
This commit is contained in:
Sam Atkins 2024-06-11 14:52:21 +01:00 committed by Eric Dubé
parent a68194090e
commit c436460b8c
6 changed files with 9 additions and 9 deletions

View File

@ -18,4 +18,5 @@
*/
globalThis.__CONFIG__ = {
sdk_url: 'http://puter.localhost:4100/sdk/puter.js',
proxy_url: 'https://cors.isomorphic-git.org',
};

View File

@ -18,4 +18,6 @@
*/
globalThis.__CONFIG__ = {
sdk_url: 'https://puter.com/puter.js/v2',
// TODO: Host a proxy ourselves, so we're not relying on (and maybe overloading) theirs.
proxy_url: 'https://cors.isomorphic-git.org',
};

View File

@ -18,8 +18,6 @@
*/
import path from 'path-browserify';
export const PROXY_URL = 'https://cors.isomorphic-git.org';
/**
* Attempt to locate the git repository directory.
* @throws Error If no git repository could be found, or another error occurred.

View File

@ -18,7 +18,6 @@
*/
import git from 'isomorphic-git';
import http from 'isomorphic-git/http/web';
import { PROXY_URL } from '../git-helpers.js';
import { SHOW_USAGE } from '../help.js';
import path from 'path-browserify';
@ -107,7 +106,7 @@ export default {
await git.clone({
fs,
http,
corsProxy: PROXY_URL,
corsProxy: globalThis.__CONFIG__.proxy_url,
dir: repo_path,
url: repository,
depth: options.depth,

View File

@ -18,7 +18,7 @@
*/
import git from 'isomorphic-git';
import http from 'isomorphic-git/http/web';
import { determine_fetch_remote, find_repo_root, PROXY_URL } from '../git-helpers.js';
import { determine_fetch_remote, find_repo_root } from '../git-helpers.js';
import { SHOW_USAGE } from '../help.js';
export default {
@ -61,7 +61,7 @@ export default {
fs,
http,
cache,
corsProxy: PROXY_URL,
corsProxy: globalThis.__CONFIG__.proxy_url,
dir,
gitdir,
remote,
@ -78,7 +78,7 @@ export default {
fs,
http,
cache,
corsProxy: PROXY_URL,
corsProxy: globalThis.__CONFIG__.proxy_url,
dir,
gitdir,
...remote_data,

View File

@ -18,7 +18,7 @@
*/
import git from 'isomorphic-git';
import http from 'isomorphic-git/http/web';
import { determine_fetch_remote, find_repo_root, PROXY_URL } from '../git-helpers.js';
import { determine_fetch_remote, find_repo_root } from '../git-helpers.js';
import { SHOW_USAGE } from '../help.js';
export default {
@ -78,7 +78,7 @@ export default {
await git.pull({
fs,
http,
corsProxy: PROXY_URL,
corsProxy: globalThis.__CONFIG__.proxy_url,
dir,
gitdir,
cache,