github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/build-blockchain-insurance-app-master/web/www/blockchain/config.js (about)

     1  import { readFileSync } from 'fs';
     2  import { resolve } from 'path';
     3  
     4  const basePath = resolve(__dirname, '../../certs');
     5  const readCryptoFile =
     6    filename => readFileSync(resolve(basePath, filename)).toString();
     7  const config = {
     8    channelName: 'default',
     9    channelConfig: readFileSync(resolve(__dirname, '../../channel.tx')),
    10    chaincodeId: 'bcins',
    11    chaincodeVersion: 'v2',
    12    chaincodePath: 'bcins',
    13    orderer0: {
    14      hostname: 'orderer0',
    15      url: 'grpcs://orderer0:7050',
    16      pem: readCryptoFile('ordererOrg.pem')
    17    },
    18    insuranceOrg: {
    19      peer: {
    20        hostname: 'insurance-peer',
    21        url: 'grpcs://insurance-peer:7051',
    22        eventHubUrl: 'grpcs://insurance-peer:7053',
    23        pem: readCryptoFile('insuranceOrg.pem')
    24      },
    25      ca: {
    26        hostname: 'insurance-ca',
    27        url: 'https://insurance-ca:7054',
    28        mspId: 'InsuranceOrgMSP'
    29      },
    30      admin: {
    31        key: readCryptoFile('Admin@insurance-org-key.pem'),
    32        cert: readCryptoFile('Admin@insurance-org-cert.pem')
    33      }
    34    },
    35    policeOrg: {
    36      peer: {
    37        hostname: 'police-peer',
    38        url: 'grpcs://police-peer:7051',
    39        eventHubUrl: 'grpcs://police-peer:7053',
    40        pem: readCryptoFile('policeOrg.pem')
    41      },
    42      ca: {
    43        hostname: 'police-ca',
    44        url: 'https://police-ca:7054',
    45        mspId: 'PoliceOrgMSP'
    46      },
    47      admin: {
    48        key: readCryptoFile('Admin@police-org-key.pem'),
    49        cert: readCryptoFile('Admin@police-org-cert.pem')
    50      }
    51    },
    52    shopOrg: {
    53      peer: {
    54        hostname: 'shop-peer',
    55        url: 'grpcs://shop-peer:7051',
    56        eventHubUrl: 'grpcs://shop-peer:7053',
    57        pem: readCryptoFile('shopOrg.pem')
    58      },
    59      ca: {
    60        hostname: 'shop-ca',
    61        url: 'https://shop-ca:7054',
    62        mspId: 'ShopOrgMSP'
    63      },
    64      admin: {
    65        key: readCryptoFile('Admin@shop-org-key.pem'),
    66        cert: readCryptoFile('Admin@shop-org-cert.pem')
    67      }
    68    },
    69    repairShopOrg: {
    70      peer: {
    71        hostname: 'repairshop-peer',
    72        url: 'grpcs://repairshop-peer:7051',
    73        pem: readCryptoFile('repairShopOrg.pem'),
    74        eventHubUrl: 'grpcs://repairshop-peer:7053',
    75      },
    76      ca: {
    77        hostname: 'repairshop-ca',
    78        url: 'https://repairshop-ca:7054',
    79        mspId: 'RepairShopOrgMSP'
    80      },
    81      admin: {
    82        key: readCryptoFile('Admin@repairshop-org-key.pem'),
    83        cert: readCryptoFile('Admin@repairshop-org-cert.pem')
    84      }
    85    }
    86  };
    87  
    88  if (process.env.LOCALCONFIG) {
    89    config.orderer0.url = 'grpcs://localhost:7050';
    90  
    91    config.insuranceOrg.peer.url = 'grpcs://localhost:7051';
    92    config.shopOrg.peer.url = 'grpcs://localhost:8051';
    93    config.repairShopOrg.peer.url = 'grpcs://localhost:9051';
    94    config.policeOrg.peer.url = 'grpcs://localhost:10051';
    95  
    96    config.insuranceOrg.peer.eventHubUrl = 'grpcs://localhost:7053';
    97    config.shopOrg.peer.eventHubUrl = 'grpcs://localhost:8053';
    98    config.repairShopOrg.peer.eventHubUrl = 'grpcs://localhost:9053';
    99    config.policeOrg.peer.eventHubUrl = 'grpcs://localhost:10053';
   100  
   101    config.insuranceOrg.ca.url = 'https://localhost:7054';
   102    config.shopOrg.ca.url = 'https://localhost:8054';
   103    config.repairShopOrg.ca.url = 'https://localhost:9054';
   104    config.policeOrg.ca.url = 'https://localhost:10054';
   105  }
   106  
   107  export default config;
   108  
   109  export const DEFAULT_CONTRACT_TYPES = [
   110    {
   111      uuid: '63ef076a-33a1-41d2-a9bc-2777505b014f',
   112      shopType: 'B',
   113      formulaPerDay: 'price * 0.01 + 0.05',
   114      maxSumInsured: 4300.00,
   115      theftInsured: true,
   116      description: 'Contract for Mountain Bikers',
   117      conditions: 'Contract Terms here',
   118      minDurationDays: 1,
   119      maxDurationDays: 7,
   120      active: true
   121    },
   122    {
   123      uuid: '1d640cf7-9808-4c78-b7f0-55aaad02e9e5',
   124      shopType: 'B',
   125      formulaPerDay: 'price * 0.02',
   126      maxSumInsured: 3500.00,
   127      theftInsured: false,
   128      description: 'Insure Your Bike',
   129      conditions: 'Simple contract terms.',
   130      minDurationDays: 3,
   131      maxDurationDays: 10,
   132      active: true
   133    },
   134    {
   135      uuid: '17210a72-f505-42bf-a238-65c8898477e1',
   136      shopType: 'P',
   137      formulaPerDay: 'price * 0.001 + 5.00',
   138      maxSumInsured: 1500.00,
   139      theftInsured: true,
   140      description: 'Phone Insurance Contract',
   141      conditions: 'Exemplary contract terms here.',
   142      minDurationDays: 5,
   143      maxDurationDays: 10,
   144      active: true
   145    },
   146    {
   147      uuid: '17d773dc-2624-4c22-a478-87544dd0a17f',
   148      shopType: 'P',
   149      formulaPerDay: 'price * 0.005 + 10.00',
   150      maxSumInsured: 2500.00,
   151      theftInsured: true,
   152      description: 'Premium SmartPhone Insurance',
   153      conditions: 'Only for premium phone owners.',
   154      minDurationDays: 10,
   155      maxDurationDays: 20,
   156      active: true
   157    },
   158    {
   159      uuid: 'd804f730-8c77-4583-9247-ec9e753643db',
   160      shopType: 'S',
   161      formulaPerDay: '25.00',
   162      maxSumInsured: 5000.00,
   163      theftInsured: false,
   164      description: 'Short-Term Ski Insurance',
   165      conditions: 'Simple contract terms here.',
   166      minDurationDays: 3,
   167      maxDurationDays: 25,
   168      active: true
   169    },
   170    {
   171      uuid: 'dcee27d7-bf3c-4995-a272-8a306a35e51f',
   172      shopType: 'S',
   173      formulaPerDay: 'price * 0.001 + 10.00',
   174      maxSumInsured: 3000.00,
   175      theftInsured: true,
   176      description: 'Insure Ur Ski',
   177      conditions: 'Just do it.',
   178      minDurationDays: 1,
   179      maxDurationDays: 15,
   180      active: true
   181    },
   182    {
   183      uuid: 'c06f95d6-9b90-4d24-b8cb-f347d1b33ddf',
   184      shopType: 'BPS',
   185      formulaPerDay: '50',
   186      maxSumInsured: 3000.00,
   187      theftInsured: false,
   188      description: 'Universal Insurance Contract',
   189      conditions: 'Universal Contract Terms here. For all types of goods.',
   190      minDurationDays: 1,
   191      maxDurationDays: 10,
   192      active: true
   193    }
   194  ];