If you already have a harbor backend environment, you can build a frontend development environment with the following configuration.

    1. Open the terminal and run the following command to copy “proxy.config.mjs.temp” file to “proxy.config.mjs”.

      1. cd harbor/src/portal
      2. cp proxy.config.mjs.temp proxy.config.mjs

      NOTE: You should specify an available Harbor hostname. And you can specify the agent if you work behind a corporate proxy.

    1. import HttpsProxyAgent from 'https-proxy-agent';
    2. // Define the proxy configuration
    3. const HarborProxyConfig = [
    4. {
    5. "context": [
    6. "/api",
    7. "/c",
    8. "/i18n",
    9. "/chartrepo",
    10. "/LICENSE",
    11. "/swagger.json",
    12. "/devcenter-api-2.0",
    13. "/swagger-ui.bundle.js"
    14. ],
    15. "target": "${A Harbor server}",
    16. "secure": false,
    17. "changeOrigin": true,
    18. "logLevel": "debug"
    19. }
    20. ];
    21. // Define if you use agent
    22. const useAgent = false;
    23. // Specify an agent server, if empty, will read it from environment variable http_proxy or HTTP_PROXY
    24. const specifiedAgentServer = "${An agent server}";
    25. function setupForCorporateProxy(proxyConfig) {
    26. if (useAgent) {
    27. const agentServer = process.env.http_proxy || process.env.HTTP_PROXY || specifiedAgentServer;
    28. if (agentServer) {
    29. const agent = new HttpsProxyAgent(agentServer);
    30. console.log('Using corporate agent server: ' + agentServer);
    31. proxyConfig.forEach(function (entry) {
    32. entry.agent = agent;
    33. });
    34. }
    35. }
    36. return proxyConfig;
    37. }
    38. export default setupForCorporateProxy(HarborProxyConfig);
    1. Install npm packages and 3rd-party dependencies.

      1. npm install
    2. Execute the following command,serve Harbor locally.

      1. npm run start
    3. Then you can visit the Harbor by address: https://localhost:4200.