export * from './npm-publicserver.classes.uipublicserver.js';

import { UiPublicServer } from './npm-publicserver.classes.uipublicserver.js';

process.env.UIP_ENV = process.env.BACKEND_URL?.includes('develop-backend') ? 'dev' : 'prod';

export const defaultPublicServer = new UiPublicServer({
  port: 3000,
  npmRegistryUrl: 'https://registry.npmjs.org/',
  allowedPackages: [
    '@push.rocks/smartfile'
  ],
  mode: process.env.UIP_ENV === 'dev' ? 'dev' : 'prod',
  log: false,
});

export const runCli = async () => {
  await defaultPublicServer.startServer();
}

export const stop = async () => {
  await defaultPublicServer.stopServer();
}
