1 Star 0 Fork 0

fancy001/goahead

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.bit 14.32 KB
一键复制 编辑 原始数据 按行查看 历史
/*
main.bit -- Main Bit file for GoAhead
This file contains the rules for targets to build and default settings for configuration.
The Bit utility (http://ejscript.org) may be used to build GoAhead instead of make. Bit provides
for configured builds and generates projects files.
Alternatively, build using the "make" utility in which case this file is not used.
*/
Bit.load({
blend: [
"${BITS}/embedthis.bit",
"src/paks/est/est.bit",
"doc/doc.bit",
],
settings: {
bit: '0.9.3',
sync: [ 'bitos', 'est' ],
packs: [ 'bits/packs' ],
/*
Installation prefix set
*/
prefixes: 'embedthis-prefixes',
manifest: 'package/manifest.bit',
/*
Optional packs to automatically discover and configure
*/
'+discover': [ 'doxygen', 'dsi', 'man', 'man2html', 'pmaker', 'ssl', 'utest', 'zip' ],
'+requires': [ 'compiler' ],
/*
Packs to disable when using --without all
*/
'without-all': [ 'doxygen', 'dsi', 'man', 'man2html', 'pmaker', 'ssl' ],
/*
Set to true for a static link
*/
static: false,
goahead: {
/*
Log for request access logging
*/
accessLog: false,
/*
User authentication
*/
auth: true,
/*
Select the password store mechanism. Set to: pam, file, custom
If using PAM, must also set authPam to true
*/
authStore: "file",
/*
Automatically login. Useful for debugging.
*/
autoLogin: false,
/*
SSL file of certificates
*/
ca: "",
clientCache: [ 'css', 'gif', 'ico', 'jpg', 'js', 'png', ],
clientCacheLifespan: 86400,
/*
Server certificate file for SSL. This is a test self-signed certificate.
A valid certificate must be obtained or generated.
*/
certificate: "self.crt",
/*
Cipher suite for SSL. This is SSL stack dependant and only supported on EST and OpenSSL
OpenSSL: AES128-SHA or "HIGH:RC4+SHA",
EST:"TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_RC4_128_SHA",
*/
ciphers: "",
/*
Build with CGI support and directory for CGI programs.
The cgiBin is a unique path prefix for CGI URIs.
*/
cgi: true,
cgiBin: "cgi-bin",
/*
Directory containing web documents to serve
*/
documents: "web",
/*
Enable X-Frame-Origin to prevent clickjacking. Set to empty to disable.
Set to: DENY, SAMEORIGIN, ALLOW uri
*/
xframeHeader: "SAMEORIGIN",
/*
Build with support for javascript web templates
*/
javascript: true,
/*
Server SSL key. This is by default set to a test key.
This must be regenerated.
*/
key: "self.key",
/*
Define legacy APIs for compatibility with old GoAhead web server applications
*/
legacy: true,
/*
Sandbox limits and allocation sizes
*/
limitBuffer: 8192, /* I/O Buffer size. Also chunk size. */
limitFiles: 0, /* Maximum files/sockets. Set to zero for unlimited. Unix only */
limitFilename: 256, /* Maximum filename size */
limitHeader: 2048, /* Maximum HTTP single header size */
limitHeaders: 4096, /* Maximum HTTP header size */
limitNumHeaders: 64, /* Maximum number of headers */
limitParseTimeout: 5, /* Maximum time to parse the request headers */
limitPassword: 32, /* Maximum password size */
limitPost: 16384, /* Maximum POST incoming body size */
limitPut: 204800000, /* Maximum PUT body size ~ 200MB */
limitSessionLife: 1800, /* Session lifespan in seconds (30 mins) */
limitSessionCount: 512, /* Maximum number of sessions to support */
limitString: 4096, /* Default string size */
limitTimeout: 60, /* Request inactivity timeout in seconds */
limitUri: 2048, /* Maximum URI size */
limitUpload: 204800000, /* Maximum upload size ~ 200MB */
/*
Addresses to listen on. This specifies the protocol, interface and port.
*/
listen: ["http://*:80", "https://*:443"]
/*
Enable application logging
*/
logging: true,
logfile: "stderr:0",
/*
Temporary directory to hold PUT files
*/
putDir: "/tmp",
/*
Authentication realm. Replace with your realm.
*/
realm: "example.com",
/*
Replace malloc with a non-fragmenting allocator
*/
replaceMalloc: false,
/*
Enable stealth options. Disable OPTIONS and TRACE methods.
*/
stealth: true,
/*
Enable debug trace and asserts
*/
tracing: true,
/*
Upload file support
*/
upload: true,
uploadDir: "/tmp",
/*
Verify client certificates
*/
verifyPeer: false,
/*
Verify issuer. If false, allows self-signed certificates for testing purposes.
*/
verifyIssuer: false,
},
},
usage: {
'goahead.accessLog': 'Enable request access log (true|false)',
'goahead.caFile': 'File of client certificates (path)',
'goahead.certificate': 'Server certificate for SSL (path)',
'goahead.ciphers': 'SSL cipher suite (string)',
'goahead.cgi': 'Enable the CGI handler (true|false)',
'goahead.cgiBin': 'Directory CGI programs (path)',
'goahead.clientCache': 'Extensions to cache in the client (Array)',
'goahead.clientCacheLifespan':'Lifespan in seconds to cache in the client',
'goahead.javascript': 'Enable the Javascript JST handler (true|false)',
'goahead.key': 'Server private key for SSL (path)',
'goahead.legacy': 'Enable the GoAhead 2.X legacy APIs (true|false)',
'goahead.limitBuffer': 'I/O Buffer size. Also chunk size.',
'goahead.limitFilename': 'Maximum filename size',
'goahead.limitHeader': 'Maximum HTTP single header size',
'goahead.limitHeaders': 'Maximum HTTP header size',
'goahead.limitNumHeaders': 'Maximum number of headers',
'goahead.limitPassword': 'Maximum password size',
'goahead.limitPost': 'Maximum POST (and other method) incoming body size',
'goahead.limitPut': 'Maximum PUT body size ~ 200MB',
'goahead.limitSessionLife': 'Session lifespan in seconds (30 mins)',
'goahead.limitSessionCount': 'Maximum number of sessions to support',
'goahead.limitString': 'Default string allocation size',
'goahead.limitTimeout': 'Request inactivity timeout in seconds',
'goahead.limitUri': 'Maximum URI size',
'goahead.limitUpload': 'Maximum upload size ~ 200MB',
'goahead.listen': 'Addresses to listen to (["http://IP:port", ...])',
'goahead.logfile': 'Default location and level for debug log (path:level)',
'goahead.logging': 'Enable application logging (true|false)',
'goahead.pam': 'Enable Unix Pluggable Auth Module (true|false)',
'goahead.putDir': 'Define the directory for file uploaded via HTTP PUT (path)',
'goahead.realm': 'Authentication realm (string)',
'goahead.replaceMalloc': 'Replace malloc with non-fragmenting allocator (true|false)',
'goahead.static': 'Build with static linking (true|false)',
'goahead.stealth': 'Run in stealth mode. Disable OPTIONS, TRACE (true|false)',
'goahead.tracing': 'Enable debug tracing (true|false)',
'goahead.tune': 'Optimize (size|speed|balanced)',
'goahead.upload': 'Enable file upload (true|false)',
'goahead.uploadDir': 'Define directory for uploaded files (path)',
},
customize: [
/*
The optional custom.bit file is loaded after main.bit is fully processed. It can
thus override any setting. Feel free to create and customize.
*/
'custom.bit',
],
scripts: {
postconfig: "
if (bit.settings.goahead.authStore != 'pam') {
bit.settings.hasPam = false
}
",
},
targets: {
/*
Target for the goahead executable
*/
libgo: {
enable: true,
type: 'lib',
sources: [ 'src/*.c', 'src/ssl/*.c' ],
headers: [ 'src/*.h' ],
exclude: /goahead\.c/,
depends: [ 'ssl' ],
scripts: {
prebuild: "
if (bit.settings.hasPam && bit.settings.goahead.pam) {
bit.target.libraries.push('pam')
}
",
},
},
goahead: {
type: 'exe',
sources: [ 'src/goahead.c' ],
headers: [ 'src/*.h' ],
depends: [ 'libgo' ],
scripts: {
prebuild: "
if (bit.settings.hasPam) {
bit.target.libraries.push('pam')
}
",
},
},
/*
Target for unit tests. Includes ASP and form callbacks
*/
'goahead-test': {
enable: "bit.settings.profile != 'release'",
type: 'exe',
sources: [ 'test/test.c' ],
headers: [ 'src/*.h' ],
depends: [ 'libgo' ],
scripts: {
prebuild: "
if (bit.settings.hasPam) {
bit.target.libraries.push('pam')
}
",
},
},
'bower.json': {
type: 'file',
path: 'bower.json',
files: [ 'package.json' ],
},
/*
Compiler for web pages into C code
*/
gopass: {
enable: 'bit.settings.goahead.auth',
type: 'exe',
sources: [ 'src/utils/gopass.c' ],
headers: [ 'src/*.h' ],
depends: [ 'libgo' ],
},
/*
Compiler for web pages into C code
*/
webcomp: {
enable: 'bit.settings.rom',
type: 'exe',
sources: [ 'src/utils/webcomp.c' ],
headers: [ 'src/*.h' ],
depends: [ ],
},
cgitest: {
enable: 'bit.settings.cgi',
path: 'test/cgi-bin/cgitest${EXE}'
type: 'exe',
sources: [ 'test/cgitest.c' ],
headers: [ 'src/*.h' ],
},
test: {
action: "
let ro = {noio: true, dir: 'test'}
let depth = bit.settings.depth
run('utest -v -i 2 --depth ' + depth, ro)
if (depth >= 3) {
trace('Test', 'Light load tests')
run('utest -v -i 20 --depth ' + depth, ro)
for each (t in [2, 4]) {
trace('Test', 'Light thread tests')
run('utest -v -i 20 --depth ' + depth + ' --threads ' + t, ro)
}
}
if (depth >= 4) {
trace('Test', 'Longevity load tests')
run('utest -v -i 100 --depth ' + depth, ro)
for each (t in [8, 16]) {
trace('Test', 'Light thread tests')
run('utest -v -i 100 --depth ' + depth + ' --threads ' + t, ro)
}
}
trace('Test', 'Unit tests complete')
",
platforms: [ 'local' ],
},
run: {
home: 'src',
run: 'goahead -v',
},
rom: {
action: "Path('src/rom-documents.c').write(Cmd.run('webcomp --prefix / rom.files', {dir: 'test'}))",
},
install: {
home: '${TOP}',
generate: ' ',
depends: [ 'all', 'stop', 'installBinary', 'start' ],
action: "
trace('Info', bit.settings.title + ' installed at ' + bit.prefixes.vapp)
trace('Info', 'Configuration directory ' + bit.prefixes.etc)
trace('Info', 'Documents directory ' + bit.prefixes.web)
trace('Info', 'Executables directory ' + bit.prefixes.vapp.join('bin'))
trace('Info', 'Use \"man goahead\" for usage')
trace('Info', 'Run via \"cd ' + bit.prefixes.etc + ' ; sudo goahead -v ' + bit.prefixes.web + '\"')
trace('Info', 'Browse to ' + bit.settings.goahead.listen[0].replace('*', 'localhost').replace(':80', '/'))
let pid = Cmd.ps('goahead')
if (pid && pid.length > 0) {
trace('Info', bit.settings.title + ' PID: ' + pid[0].pid)
}
",
},
},
packDefaults: {
est: true,
ssl: true,
},
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/fancy001/goahead.git
git@gitee.com:fancy001/goahead.git
fancy001
goahead
goahead
master

搜索帮助