- Dart Cookbook
- Ivo Balbaert
- 223字
- 2021-08-05 17:42:44
Hosting your own private pub mirror
Another possibility for when the pub repository is not reachable (because you have no Internet access or work behind a very strict firewall) is to host your own private pub mirror.
How to do it...
Follow these steps to host your own private pub mirror:
- You need a server that speaks to the pub's HTTP API. Documentation on that standalone API does not yet exist, but the main pub server running at pub.dartlang.org is open source with its code living at https://github.com/dart-lang/pub-dartlang. To run the server locally, go through these steps:
- Install the App Engine SDK for Python.
- Verify that its path is in
$PATH
. - Install the pip installation file, beautifulsoup4, and pycrypto webtest packages.
- From the top-level directory, run this command to start the pub server
dev_appserver.py app
. - Verify that it works in your browser with
http://localhost:8080/
.
- You need to set a
PUB_HOSTED_URL
environment variable to point to the URL of your mirror server, so that the pub will look there to download the hosted dependencies, for example,PUB_HOSTED_URL = http://me:mypassword@127.0.0.1:8042
. - Manually upload the packages you need to your server, visit
http://localhost:8080/admin
(sign in as an administrator), go to the Private Key tab, and enter any string into the private key field.
How it works...
The server from can be run from an Intranet as well.
推薦閱讀
- 自動駕駛網(wǎng)絡(luò):自智時代的網(wǎng)絡(luò)架構(gòu)
- 重新定義Spring Cloud實(shí)戰(zhàn)
- Django 2 by Example
- 網(wǎng)絡(luò)安全應(yīng)急響應(yīng)技術(shù)實(shí)戰(zhàn)
- 物聯(lián)網(wǎng)與智能家居
- Android UI Design
- 從實(shí)踐中學(xué)習(xí)手機(jī)抓包與數(shù)據(jù)分析
- 轉(zhuǎn)化:提升網(wǎng)站流量和轉(zhuǎn)化率的技巧
- 物聯(lián)網(wǎng)的機(jī)遇與利用
- 智能物聯(lián)網(wǎng):區(qū)塊鏈與霧計(jì)算融合應(yīng)用詳解
- 物聯(lián)網(wǎng)與智慧廣電
- Migrating to Drupal7
- 物聯(lián)網(wǎng)導(dǎo)論
- 物聯(lián)網(wǎng)傳感器技術(shù)與應(yīng)用
- 現(xiàn)場總線與工業(yè)以太網(wǎng)及其應(yīng)用技術(shù)(第2版)