File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export interface Config {
99 cache : Path
1010 data : Path
1111
12+ dist : string
13+
1214 options : {
1315 /// prefer xz or gz for bottle downloads
1416 compression : 'xz' | 'gz'
@@ -53,6 +55,7 @@ export function ConfigDefault(env = Deno.env.toObject()): Config {
5355 const pantries = env [ 'PKGX_PANTRY_PATH' ] ?. split ( SEP ) . compact ( x => flatmap ( x . trim ( ) , x => Path . abs ( x ) ?? Path . cwd ( ) . join ( x ) ) ) ?? [ ]
5456 const cache = ( flatmap ( env [ "XDG_CACHE_HOME" ] , Path . abs ) ?? platform_cache_default ( home , env ) ) . join ( "pkgx" )
5557 const data = ( flatmap ( env [ "XDG_DATA_HOME" ] , Path . abs ) ?? platform_data_home_default ( home , env ) ) . join ( "pkgx" )
58+ const dist = env [ 'PKGX_DIST_URL' ] ?. trim ( ) ?? 'https://dist.pkgx.dev'
5659 const isCI = boolize ( env [ 'CI' ] ) ?? false
5760 const UserAgent = flatmap ( getv ( ) , v => `libpkgx/${ v } ` ) ?? 'libpkgx'
5861 //TODO prefer 'xz' on Linux (as well) if supported
@@ -63,6 +66,7 @@ export function ConfigDefault(env = Deno.env.toObject()): Config {
6366 pantries,
6467 cache,
6568 data,
69+ dist,
6670 UserAgent,
6771 options : {
6872 compression,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import SemVer from "../utils/semver.ts"
44import useFetch from "./useFetch.ts"
55import host from "../utils/host.ts"
66import "../utils/misc.ts"
7+ import useConfig from "./useConfig.ts" ;
78
89export interface Inventory {
910 [ project : string ] : {
@@ -25,7 +26,7 @@ const select = async (rq: PackageRequirement | Package) => {
2526
2627const get = async ( rq : PackageRequirement | Package ) => {
2728 const { platform, arch } = host ( )
28- const url = new URL ( `https://dist.pkgx.dev /${ rq . project } /${ platform } /${ arch } /versions.txt` )
29+ const url = new URL ( `${ useConfig ( ) . dist } /${ rq . project } /${ platform } /${ arch } /versions.txt` )
2930 const rsp = await useFetch ( url )
3031
3132 if ( ! rsp . ok ) {
Original file line number Diff line number Diff line change 11import { Stowage } from "../types.ts"
22import host from "../utils/host.ts"
3+ import useConfig from "./useConfig.ts" ;
34
45type Type = 's3'
56
@@ -24,5 +25,5 @@ function key(stowage: Stowage) {
2425}
2526
2627function url ( stowage : Stowage ) {
27- return new URL ( `https://dist.pkgx.dev /${ key ( stowage ) } ` )
28+ return new URL ( `${ useConfig ( ) . dist } /${ key ( stowage ) } ` )
2829}
You can’t perform that action at this time.
0 commit comments