| 37 | } |
| 38 | |
| 39 | async function bin (argv, server) { |
| 40 | if (!argv.email) { |
| 41 | argv.email = { |
| 42 | host: argv.emailHost, |
| 43 | port: argv.emailPort, |
| 44 | secure: true, |
| 45 | auth: { |
| 46 | user: argv.emailAuthUser, |
| 47 | pass: argv.emailAuthPass |
| 48 | } |
| 49 | } |
| 50 | delete argv.emailHost |
| 51 | delete argv.emailPort |
| 52 | delete argv.emailAuthUser |
| 53 | delete argv.emailAuthPass |
| 54 | } |
| 55 | if (!argv.tokenTypesSupported) { |
| 56 | argv.tokenTypesSupported = ['legacyPop', 'dpop'] |
| 57 | } |
| 58 | argv.live = !argv.noLive |
| 59 | if (!argv.quiet) { |
| 60 | const debug = await import('debug') |
| 61 | debug.default.enable('solid:*') |
| 62 | } |
| 63 | argv.port = argv.port || 3456 |
| 64 | if (argv.webid !== false) { |
| 65 | argv.webid = true |
| 66 | } |
| 67 | if (!argv.webid && argv.multiuser) { |
| 68 | throw new Error('Server cannot operate as multiuser without webids') |
| 69 | } |
| 70 | if (process.platform !== 'win32') { |
| 71 | process.on('SIGINT', function () { |
| 72 | console.log('\nSolid stopped.') |
| 73 | process.exit() |
| 74 | }) |
| 75 | } |
| 76 | if (argv.owner) { |
| 77 | let rootPath = path.resolve(argv.root || process.cwd()) |
| 78 | if (!(rootPath.endsWith('/'))) { |
| 79 | rootPath += '/' |
| 80 | } |
| 81 | rootPath += (argv.suffixAcl || '.acl') |
| 82 | const defaultAcl = `@prefix n0: <http://www.w3.org/ns/auth/acl#>. |
| 83 | @prefix n2: <http://xmlns.com/foaf/0.1/>. |
| 84 | |
| 85 | <#owner> |
| 86 | a n0:Authorization; |
| 87 | n0:accessTo <./>; |
| 88 | n0:agent <${argv.owner}>; |
| 89 | n0:default <./>; |
| 90 | n0:mode n0:Control, n0:Read, n0:Write. |
| 91 | <#everyone> |
| 92 | a n0:Authorization; |
| 93 | n0: n2:Agent; |
| 94 | n0:accessTo <./>; |
| 95 | n0:default <./>; |
| 96 | n0:mode n0:Read.` |