File: mongodb_example_config.php

package info (click to toggle)
mongrel2 1.11.0-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,976 kB
  • ctags: 5,326
  • sloc: ansic: 38,934; python: 2,833; sql: 1,555; sh: 457; makefile: 358; asm: 189; yacc: 145; php: 73; awk: 28; sed: 5
file content (90 lines) | stat: -rw-r--r-- 2,225 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php


$cfg = array(
    'server' => 'mongodb://localhost:27017',
    'options' => array('connect' => true),
    'database' => 'mongrel2',
);
$con = new \Mongo($cfg['server'], $cfg['options']);
$db = $con->selectDB($cfg['database']);

// Setting
$setting = array (
  'id' => new MongoInt32(1),
  'key' => 'upload:temp_store',
  'value' => '/mongrel2/tmp/mongrel2.upload.XXXXXX',
);
$db->setting->insert($setting, array('safe' => true));
$setting = array (
  'id' => new MongoInt32(2),
  'key' => 'limits.content_length',
  'value' => '2097152000',
);
$db->setting->insert($setting, array('safe' => true));

// Host
$host = array (
  'id' => new MongoInt32(1),
  'server_id' => new MongoInt32(1),
  'maintenance' => false,
  'name' => 'localhost',
  'matching' => 'localhost',
);
$db->host->insert($host, array('safe' => true));

// Mimetype
$mimetype = array (
  'id' => 2,
  'mimetype' => 'application/x-msbinderssss',
  'extension' => '.odbs',
);
$db->mimetype->insert($mimetype, array('safe' => true));
$mimetype = array (
  'id' => 1,
  'mimetype' => 'application/x-msbinder',
  'extension' => '.odb',
);
$db->mimetype->insert($mimetype, array('safe' => true));

// Route
$route = array (
  'id' => new MongoInt32(1),
  'path' => '/',
  'reversed' => false,
  'host_id' => new MongoInt32(1),
  'target_id' => new MongoInt32(1),
  'target_type' => 'handler',
);
$db->route->insert($route, array('safe' => true));

// Server
$server = array (
  'access_log' => '/mongrel2/logs/access.log',
  'bind_addr' => '0.0.0.0',
  'chroot' => './',
  'default_host' => 'localhost',
  'error_log' => '/mongrel2/logs/error.log',
  'id' => new MongoInt32(1),
  'name' => 'main',
  'pid_file' => '/mongrel2/run/mongrel2.pid',
  'port' => 6767,
  'use_ssl' => new MongoInt32(0),
  'uuid' => '971e0536-a92d-41e2-bea3-9af54bfd6fd9',
);
$db->server->insert($server, array('safe' => true));

// Handler
$handler = array (
  'id' => new MongoInt32(1),
  'send_spec' => 'tcp://127.0.0.1:9001',
  'send_ident' => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'recv_spec' => 'tcp://127.0.0.1:9000',
  'recv_ident' => '',
  'raw_payload' => new MongoInt32(0),
  'protocol' => 'json',
);
$db->handler->insert($handler, array('safe' => true));

echo 'Done.';