@rxap/config 19.2.0 → 19.3.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/compodoc/changelog.html +10 -0
- package/compodoc/dependencies.html +2 -2
- package/compodoc/injectables/ConfigService.html +145 -93
- package/compodoc/interfaces/ConfigLoadOptions.html +209 -58
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/miscellaneous/enumerations.html +53 -0
- package/compodoc/miscellaneous/functions.html +60 -9
- package/compodoc/miscellaneous/typealiases.html +21 -0
- package/compodoc/miscellaneous/variables.html +185 -0
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +1443 -720
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/ConfigLoaderService.html +2 -2
- package/docs/html/classes/ConfigService.html +6 -6
- package/docs/html/classes/ConfigTestingService.html +2 -2
- package/docs/html/enums/ConfigLoadMethod.html +5 -0
- package/docs/html/enums/ConfigLoadingStrategy.html +2 -2
- package/docs/html/functions/ProvideConfig.html +1 -1
- package/docs/html/functions/dnsLookup.html +1 -1
- package/docs/html/functions/dnsResolver.html +1 -1
- package/docs/html/functions/fetchCidContent.html +1 -1
- package/docs/html/functions/fetchCidContentAsJson.html +1 -1
- package/docs/html/functions/fetchCidContentViaHttp.html +1 -1
- package/docs/html/functions/fetchContentViaHttp.html +1 -1
- package/docs/html/functions/localPathIpfsGateway.html +1 -0
- package/docs/html/functions/localSubDomainIpfsGateway.html +1 -0
- package/docs/html/functions/raceSuccess.html +2 -2
- package/docs/html/functions/storachaIpfsGateway.html +1 -0
- package/docs/html/functions/w3sIpfsGateway.html +1 -0
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/AppsNavigationConfig.html +2 -2
- package/docs/html/interfaces/Config.html +2 -2
- package/docs/html/interfaces/ConfigLoadOptions.html +11 -5
- package/docs/html/interfaces/LogoConfig.html +2 -2
- package/docs/html/interfaces/NavigationConfig.html +2 -2
- package/docs/html/interfaces/Oauth2Config.html +2 -2
- package/docs/html/interfaces/i18nConfig.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/html/types/AnySchema.html +1 -1
- package/docs/html/types/IpfsGatewayFunction.html +1 -0
- package/docs/html/types/Join.html +1 -1
- package/docs/html/types/LanguagesConfig.html +1 -1
- package/docs/html/types/Leaves.html +1 -1
- package/docs/html/types/NoInferType.html +1 -1
- package/docs/html/types/Paths.html +1 -1
- package/docs/html/variables/RXAP_CONFIG.html +1 -1
- package/docs/html/variables/defaultDnsServers.html +1 -0
- package/docs/html/variables/defaultIpfsGatewayServers.html +1 -0
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/ConfigLoaderService.md +7 -7
- package/docs/markdown/classes/ConfigService.md +22 -22
- package/docs/markdown/classes/ConfigTestingService.md +8 -8
- package/docs/markdown/enumerations/ConfigLoadMethod.md +41 -0
- package/docs/markdown/enumerations/ConfigLoadingStrategy.md +4 -4
- package/docs/markdown/functions/ProvideConfig.md +2 -2
- package/docs/markdown/functions/dnsLookup.md +3 -3
- package/docs/markdown/functions/dnsResolver.md +2 -2
- package/docs/markdown/functions/fetchCidContent.md +7 -3
- package/docs/markdown/functions/fetchCidContentAsJson.md +8 -4
- package/docs/markdown/functions/fetchCidContentViaHttp.md +7 -3
- package/docs/markdown/functions/fetchContentViaHttp.md +2 -2
- package/docs/markdown/functions/localPathIpfsGateway.md +21 -0
- package/docs/markdown/functions/localSubDomainIpfsGateway.md +21 -0
- package/docs/markdown/functions/raceSuccess.md +2 -2
- package/docs/markdown/functions/storachaIpfsGateway.md +21 -0
- package/docs/markdown/functions/w3sIpfsGateway.md +21 -0
- package/docs/markdown/globals.md +10 -2
- package/docs/markdown/interfaces/AppsNavigationConfig.md +12 -12
- package/docs/markdown/interfaces/Config.md +6 -6
- package/docs/markdown/interfaces/ConfigLoadOptions.md +45 -13
- package/docs/markdown/interfaces/LogoConfig.md +5 -5
- package/docs/markdown/interfaces/NavigationConfig.md +9 -9
- package/docs/markdown/interfaces/Oauth2Config.md +3 -3
- package/docs/markdown/interfaces/i18nConfig.md +4 -4
- package/docs/markdown/type-aliases/AnySchema.md +2 -2
- package/docs/markdown/type-aliases/IpfsGatewayFunction.md +21 -0
- package/docs/markdown/type-aliases/Join.md +2 -2
- package/docs/markdown/type-aliases/LanguagesConfig.md +2 -2
- package/docs/markdown/type-aliases/Leaves.md +2 -2
- package/docs/markdown/type-aliases/NoInferType.md +2 -2
- package/docs/markdown/type-aliases/Paths.md +2 -2
- package/docs/markdown/variables/RXAP_CONFIG.md +2 -2
- package/docs/markdown/variables/defaultDnsServers.md +11 -0
- package/docs/markdown/variables/defaultIpfsGatewayServers.md +11 -0
- package/docs/wiki/Class.ConfigLoaderService.md +6 -6
- package/docs/wiki/Class.ConfigService.md +21 -21
- package/docs/wiki/Class.ConfigTestingService.md +7 -7
- package/docs/wiki/Enumeration.ConfigLoadMethod.md +37 -0
- package/docs/wiki/Enumeration.ConfigLoadingStrategy.md +3 -3
- package/docs/wiki/Function.ProvideConfig.md +1 -1
- package/docs/wiki/Function.dnsLookup.md +2 -2
- package/docs/wiki/Function.dnsResolver.md +1 -1
- package/docs/wiki/Function.fetchCidContent.md +6 -2
- package/docs/wiki/Function.fetchCidContentAsJson.md +7 -3
- package/docs/wiki/Function.fetchCidContentViaHttp.md +6 -2
- package/docs/wiki/Function.fetchContentViaHttp.md +1 -1
- package/docs/wiki/Function.localPathIpfsGateway.md +17 -0
- package/docs/wiki/Function.localSubDomainIpfsGateway.md +17 -0
- package/docs/wiki/Function.raceSuccess.md +1 -1
- package/docs/wiki/Function.storachaIpfsGateway.md +17 -0
- package/docs/wiki/Function.w3sIpfsGateway.md +17 -0
- package/docs/wiki/Interface.AppsNavigationConfig.md +11 -11
- package/docs/wiki/Interface.Config.md +5 -5
- package/docs/wiki/Interface.ConfigLoadOptions.md +44 -12
- package/docs/wiki/Interface.LogoConfig.md +4 -4
- package/docs/wiki/Interface.NavigationConfig.md +8 -8
- package/docs/wiki/Interface.Oauth2Config.md +2 -2
- package/docs/wiki/Interface.i18nConfig.md +3 -3
- package/docs/wiki/TypeAlias.AnySchema.md +1 -1
- package/docs/wiki/TypeAlias.IpfsGatewayFunction.md +17 -0
- package/docs/wiki/TypeAlias.Join.md +1 -1
- package/docs/wiki/TypeAlias.LanguagesConfig.md +1 -1
- package/docs/wiki/TypeAlias.Leaves.md +1 -1
- package/docs/wiki/TypeAlias.NoInferType.md +1 -1
- package/docs/wiki/TypeAlias.Paths.md +1 -1
- package/docs/wiki/Variable.RXAP_CONFIG.md +1 -1
- package/docs/wiki/Variable.defaultDnsServers.md +7 -0
- package/docs/wiki/Variable.defaultIpfsGatewayServers.md +7 -0
- package/docs/wiki/_Sidebar.md +8 -0
- package/docs/wiki/globals.md +9 -1
- package/fesm2022/rxap-config.mjs +112 -74
- package/fesm2022/rxap-config.mjs.map +1 -1
- package/lib/config.service.d.ts +18 -0
- package/lib/utilities.d.ts +10 -3
- package/package.json +6 -6
|
@@ -189,6 +189,20 @@
|
|
|
189
189
|
fromUrls
|
|
190
190
|
</a>
|
|
191
191
|
</li>
|
|
192
|
+
<li>
|
|
193
|
+
<span class="modifier">Optional</span>
|
|
194
|
+
<a href="#ipfsGatewayServers"
|
|
195
|
+
>
|
|
196
|
+
ipfsGatewayServers
|
|
197
|
+
</a>
|
|
198
|
+
</li>
|
|
199
|
+
<li>
|
|
200
|
+
<span class="modifier">Optional</span>
|
|
201
|
+
<a href="#order"
|
|
202
|
+
>
|
|
203
|
+
order
|
|
204
|
+
</a>
|
|
205
|
+
</li>
|
|
192
206
|
<li>
|
|
193
207
|
<span class="modifier">Optional</span>
|
|
194
208
|
<a href="#schema"
|
|
@@ -506,6 +520,91 @@ If true, uses <code>location.hostname</code>. If a string, uses that domain.</p>
|
|
|
506
520
|
|
|
507
521
|
|
|
508
522
|
|
|
523
|
+
</tbody>
|
|
524
|
+
</table>
|
|
525
|
+
<table class="table table-sm table-bordered">
|
|
526
|
+
<tbody>
|
|
527
|
+
<tr>
|
|
528
|
+
<td class="col-md-4">
|
|
529
|
+
<a name="ipfsGatewayServers"></a>
|
|
530
|
+
<span class="name "><b>ipfsGatewayServers</b>
|
|
531
|
+
<a href="#ipfsGatewayServers">
|
|
532
|
+
<span class="icon ion-ios-link"></span>
|
|
533
|
+
</a>
|
|
534
|
+
</span>
|
|
535
|
+
</td>
|
|
536
|
+
</tr>
|
|
537
|
+
<tr>
|
|
538
|
+
<td class="col-md-4">
|
|
539
|
+
<code>ipfsGatewayServers: <code>Array<string></code>
|
|
540
|
+
</code>
|
|
541
|
+
</td>
|
|
542
|
+
</tr>
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
<tr>
|
|
546
|
+
<td class="col-md-4">
|
|
547
|
+
<i>Type : </i> <code>Array<string></code>
|
|
548
|
+
|
|
549
|
+
</td>
|
|
550
|
+
</tr>
|
|
551
|
+
|
|
552
|
+
<tr>
|
|
553
|
+
<td class="col-md-4">
|
|
554
|
+
<i>Optional</i>
|
|
555
|
+
</td>
|
|
556
|
+
</tr>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
</tbody>
|
|
562
|
+
</table>
|
|
563
|
+
<table class="table table-sm table-bordered">
|
|
564
|
+
<tbody>
|
|
565
|
+
<tr>
|
|
566
|
+
<td class="col-md-4">
|
|
567
|
+
<a name="order"></a>
|
|
568
|
+
<span class="name "><b>order</b>
|
|
569
|
+
<a href="#order">
|
|
570
|
+
<span class="icon ion-ios-link"></span>
|
|
571
|
+
</a>
|
|
572
|
+
</span>
|
|
573
|
+
</td>
|
|
574
|
+
</tr>
|
|
575
|
+
<tr>
|
|
576
|
+
<td class="col-md-4">
|
|
577
|
+
<code>order: <code><a href="../interfaces/Config.html" target="_self" >ConfigLoadMethod[]</a></code>
|
|
578
|
+
</code>
|
|
579
|
+
</td>
|
|
580
|
+
</tr>
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
<tr>
|
|
584
|
+
<td class="col-md-4">
|
|
585
|
+
<i>Type : </i> <code><a href="../interfaces/Config.html" target="_self" >ConfigLoadMethod[]</a></code>
|
|
586
|
+
|
|
587
|
+
</td>
|
|
588
|
+
</tr>
|
|
589
|
+
|
|
590
|
+
<tr>
|
|
591
|
+
<td class="col-md-4">
|
|
592
|
+
<i>Optional</i>
|
|
593
|
+
</td>
|
|
594
|
+
</tr>
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
<tr>
|
|
600
|
+
<td class="col-md-4">
|
|
601
|
+
<div class="io-description"><p>Defines the order and subset of config sources to load.
|
|
602
|
+
If not specified, defaults to: [FROM_URLS, FROM_LOCAL_STORAGE, FROM_URL_PARAM, FROM_CID]</p>
|
|
603
|
+
<p>Note: static config is always merged first, and Overwrites are always merged last.
|
|
604
|
+
Note: fromDns is not a source itself - it resolves the CID for FROM_CID.</p>
|
|
605
|
+
</div>
|
|
606
|
+
</td>
|
|
607
|
+
</tr>
|
|
509
608
|
</tbody>
|
|
510
609
|
</table>
|
|
511
610
|
<table class="table table-sm table-bordered">
|
|
@@ -699,6 +798,13 @@ export enum ConfigLoadingStrategy {
|
|
|
699
798
|
FIFO = 'fifo',
|
|
700
799
|
}
|
|
701
800
|
|
|
801
|
+
export enum ConfigLoadMethod {
|
|
802
|
+
FROM_URLS = 'fromUrls',
|
|
803
|
+
FROM_LOCAL_STORAGE = 'fromLocalStorage',
|
|
804
|
+
FROM_URL_PARAM = 'fromUrlParam',
|
|
805
|
+
FROM_CID = 'fromCid',
|
|
806
|
+
}
|
|
807
|
+
|
|
702
808
|
export interface ConfigLoadOptions {
|
|
703
809
|
fromUrlParam?: string | boolean;
|
|
704
810
|
fromUrls?: boolean;
|
|
@@ -720,8 +826,17 @@ export interface ConfigLoadOptions {
|
|
|
720
826
|
*/
|
|
721
827
|
fromCid?: string;
|
|
722
828
|
fetchCidContent?: (cid: string, path?: string) => Promise<Blob | null>;
|
|
829
|
+
ipfsGatewayServers?: Array<(cid: string) => string>;
|
|
723
830
|
dnsServers?: string[];
|
|
724
831
|
strategy?: ConfigLoadingStrategy;
|
|
832
|
+
/**
|
|
833
|
+
* Defines the order and subset of config sources to load.
|
|
834
|
+
* If not specified, defaults to: [FROM_URLS, FROM_LOCAL_STORAGE, FROM_URL_PARAM, FROM_CID]
|
|
835
|
+
*
|
|
836
|
+
* Note: static config is always merged first, and Overwrites are always merged last.
|
|
837
|
+
* Note: fromDns is not a source itself - it resolves the CID for FROM_CID.
|
|
838
|
+
*/
|
|
839
|
+
order?: ConfigLoadMethod[];
|
|
725
840
|
}
|
|
726
841
|
|
|
727
842
|
@Injectable({
|
|
@@ -794,81 +909,60 @@ export class ConfigService<Config extends Record<string, any> = Re
|
|
|
794
909
|
}
|
|
795
910
|
}
|
|
796
911
|
|
|
912
|
+
// Always merge static config first
|
|
797
913
|
config = deepMerge(config, options?.static ?? {});
|
|
798
|
-
let done = false;
|
|
799
914
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
if (options.strategy !== ConfigLoadingStrategy.FIFO) {
|
|
808
|
-
console.error('Could not load config from urls', error);
|
|
809
|
-
throw error;
|
|
810
|
-
} else {
|
|
811
|
-
console.warn('Could not load config from urls: ' + error.message + '. Will try next strategy.');
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
915
|
+
// Determine the order of config sources to load
|
|
916
|
+
const order = options.order ?? [
|
|
917
|
+
ConfigLoadMethod.FROM_URLS,
|
|
918
|
+
ConfigLoadMethod.FROM_LOCAL_STORAGE,
|
|
919
|
+
ConfigLoadMethod.FROM_URL_PARAM,
|
|
920
|
+
ConfigLoadMethod.FROM_CID,
|
|
921
|
+
];
|
|
815
922
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (options.strategy === ConfigLoadingStrategy.FIFO) {
|
|
820
|
-
done = true;
|
|
821
|
-
}
|
|
822
|
-
} catch (error: any) {
|
|
823
|
-
if (options.strategy !== ConfigLoadingStrategy.FIFO) {
|
|
824
|
-
console.error('Could not load config from local storage', error);
|
|
825
|
-
throw error;
|
|
826
|
-
} else {
|
|
827
|
-
console.warn('Could not load config from local storage: ' + error.message + '. Will try next strategy.');
|
|
828
|
-
}
|
|
829
|
-
}
|
|
923
|
+
// If fromDns is enabled and FROM_CID is in the order, resolve CID first
|
|
924
|
+
if (options.fromDns && order.includes(ConfigLoadMethod.FROM_CID) && !options.fromCid) {
|
|
925
|
+
await this.loadConfigFromDns(options as any);
|
|
830
926
|
}
|
|
831
927
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
} catch (error: any) {
|
|
839
|
-
if (options.strategy !== ConfigLoadingStrategy.FIFO) {
|
|
840
|
-
console.error('Could not load config from url param', error);
|
|
841
|
-
throw error;
|
|
842
|
-
} else {
|
|
843
|
-
console.warn('Could not load config from url param: ' + error.message + '. Will try next strategy.');
|
|
844
|
-
}
|
|
928
|
+
// Load configs from sources in the specified order
|
|
929
|
+
let done = false;
|
|
930
|
+
for (const method of order) {
|
|
931
|
+
if (done) {
|
|
932
|
+
break;
|
|
845
933
|
}
|
|
846
|
-
}
|
|
847
934
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
935
|
+
// Check if the source is enabled
|
|
936
|
+
if (!this.isSourceEnabled(options, method)) {
|
|
937
|
+
continue;
|
|
938
|
+
}
|
|
851
939
|
|
|
852
|
-
if (!done && options?.fromCid) {
|
|
853
940
|
try {
|
|
854
|
-
|
|
941
|
+
const loadedConfig = await this.loadConfigFromMethod(method, options, environment);
|
|
942
|
+
if (loadedConfig) {
|
|
943
|
+
config = deepMerge(config, loadedConfig);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// If using FIFO strategy, stop after first successful load
|
|
855
947
|
if (options.strategy === ConfigLoadingStrategy.FIFO) {
|
|
856
948
|
done = true;
|
|
857
949
|
}
|
|
858
950
|
} catch (error: any) {
|
|
951
|
+
const methodName = this.getMethodName(method);
|
|
859
952
|
if (options.strategy !== ConfigLoadingStrategy.FIFO) {
|
|
860
|
-
console.error(&#
|
|
953
|
+
console.error(`Could not load config from ${methodName}`, error);
|
|
861
954
|
throw error;
|
|
862
955
|
} else {
|
|
863
|
-
console.warn(&#
|
|
956
|
+
console.warn(`Could not load config from ${methodName}: ${error.message}. Will try next strategy.`);
|
|
864
957
|
}
|
|
865
958
|
}
|
|
866
959
|
}
|
|
867
960
|
|
|
868
|
-
if (!done) {
|
|
961
|
+
if (!done && order.length > 0) {
|
|
869
962
|
console.warn('No config loading strategy succeeded. Using default config.');
|
|
870
963
|
}
|
|
871
964
|
|
|
965
|
+
// Always merge overwrites last
|
|
872
966
|
config = deepMerge(config, this.Overwrites);
|
|
873
967
|
|
|
874
968
|
console.debug('app config', config);
|
|
@@ -876,6 +970,55 @@ export class ConfigService<Config extends Record<string, any> = Re
|
|
|
876
970
|
this.Config = config;
|
|
877
971
|
}
|
|
878
972
|
|
|
973
|
+
private static isSourceEnabled(options: ConfigLoadOptions, method: ConfigLoadMethod): boolean {
|
|
974
|
+
switch (method) {
|
|
975
|
+
case ConfigLoadMethod.FROM_URLS:
|
|
976
|
+
return options.fromUrls !== false;
|
|
977
|
+
case ConfigLoadMethod.FROM_LOCAL_STORAGE:
|
|
978
|
+
return options.fromLocalStorage !== false;
|
|
979
|
+
case ConfigLoadMethod.FROM_URL_PARAM:
|
|
980
|
+
return !!options.fromUrlParam;
|
|
981
|
+
case ConfigLoadMethod.FROM_CID:
|
|
982
|
+
return !!options.fromCid;
|
|
983
|
+
default:
|
|
984
|
+
return false;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
private static async loadConfigFromMethod(
|
|
989
|
+
method: ConfigLoadMethod,
|
|
990
|
+
options: ConfigLoadOptions,
|
|
991
|
+
environment?: Environment,
|
|
992
|
+
): Promise<any> {
|
|
993
|
+
switch (method) {
|
|
994
|
+
case ConfigLoadMethod.FROM_URLS:
|
|
995
|
+
return await this.loadConfigFromUrls(options, environment);
|
|
996
|
+
case ConfigLoadMethod.FROM_LOCAL_STORAGE:
|
|
997
|
+
return this.loadConfigFromLocalStorage(options);
|
|
998
|
+
case ConfigLoadMethod.FROM_URL_PARAM:
|
|
999
|
+
return this.loadConfigFromUrlParam(options as any);
|
|
1000
|
+
case ConfigLoadMethod.FROM_CID:
|
|
1001
|
+
return await this.loadConfigFromCid(options as any);
|
|
1002
|
+
default:
|
|
1003
|
+
return null;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
private static getMethodName(method: ConfigLoadMethod): string {
|
|
1008
|
+
switch (method) {
|
|
1009
|
+
case ConfigLoadMethod.FROM_URLS:
|
|
1010
|
+
return 'urls';
|
|
1011
|
+
case ConfigLoadMethod.FROM_LOCAL_STORAGE:
|
|
1012
|
+
return 'local storage';
|
|
1013
|
+
case ConfigLoadMethod.FROM_URL_PARAM:
|
|
1014
|
+
return 'url param';
|
|
1015
|
+
case ConfigLoadMethod.FROM_CID:
|
|
1016
|
+
return 'cid';
|
|
1017
|
+
default:
|
|
1018
|
+
return 'unknown';
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
879
1022
|
private static loadConfigFromUrlParam(options: ConfigLoadOptions & { fromUrlParam: string | true }) {
|
|
880
1023
|
const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';
|
|
881
1024
|
return this.LoadConfigDefaultFromUrlParam(param);
|
|
@@ -918,8 +1061,18 @@ export class ConfigService<Config extends Record<string, any> = Re
|
|
|
918
1061
|
|
|
919
1062
|
private static async loadConfigFromCid(options: ConfigLoadOptions & { fromCid: string | boolean }) {
|
|
920
1063
|
console.debug('Loading config from CID: ', options.fromCid);
|
|
1064
|
+
const ipfsGatewayFunctions = options.ipfsGatewayServers ?? [];
|
|
1065
|
+
if (!ipfsGatewayFunctions.length) {
|
|
1066
|
+
console.warn('No IPFS gateway servers provided for fetching content from CID');
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
921
1069
|
try {
|
|
922
|
-
const cidContent = await fetchCidContentAsJson(
|
|
1070
|
+
const cidContent = await fetchCidContentAsJson(
|
|
1071
|
+
options.fromCid,
|
|
1072
|
+
undefined,
|
|
1073
|
+
options.fetchCidContent,
|
|
1074
|
+
ipfsGatewayFunctions
|
|
1075
|
+
);
|
|
923
1076
|
if (cidContent && typeof cidContent === 'object') {
|
|
924
1077
|
console.log(`Merging configuration from CID ${options.fromCid}.`, cidContent);
|
|
925
1078
|
// Merge CID content into the existing config object
|
|
@@ -939,11 +1092,9 @@ export class ConfigService<Config extends Record<string, any> = Re
|
|
|
939
1092
|
private static async loadConfigFromDns(options: ConfigLoadOptions & { fromDns: string | boolean }) {
|
|
940
1093
|
console.debug('Loading config from DNS');
|
|
941
1094
|
const dnsServers = options.dnsServers ?? [];
|
|
942
|
-
if (dnsServers.length
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
'https://cloudflare-dns.com/dns-query'
|
|
946
|
-
);
|
|
1095
|
+
if (!dnsServers.length) {
|
|
1096
|
+
console.warn('No DNS servers provided for DNS lookup');
|
|
1097
|
+
return;
|
|
947
1098
|
}
|
|
948
1099
|
let domain = location.hostname;
|
|
949
1100
|
if (typeof options.fromDns === 'string') {
|