-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathexample.js
More file actions
74 lines (60 loc) · 1.29 KB
/
example.js
File metadata and controls
74 lines (60 loc) · 1.29 KB
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
var GitServer, repoOne, repoTwo, repos, _git;
GitServer = require('./main.js');
/*
##Create example repo 1
This repo does NOT allow Anonymous access
*/
repoOne = {
name: 'stackdot',
anonRead: false,
users: [
{
user: {
username: 'demo',
password: 'demo'
},
permissions: ['R', 'W']
}
]
};
/*
##Create example repo 2
This repo allows Anonymous reading (fetch,clone) access
*/
repoTwo = {
name: 'anon',
anonRead: true,
users: [
{
user: {
username: 'demo2',
password: 'demo2'
},
permissions: ['R', 'W']
}
],
onSuccessful: {
fetch: function() {
return console.log('Successful fetch on "anon" repo');
},
push: function() {
return console.log('Success push on "anon" repo');
}
}
};
repos = [repoOne, repoTwo];
/*
#Create the GitServer object
We are passing in `repos` array for the list of Repos we want to run return
We are passing in `true` to enable verbose logging return
We are passing in `/tmp/repos` to specify where the .git repos should live return
We are passing in `7000` for the port to run on ( port 80 requires sudo )
*/
options = {
repos: repos,
logging: true,
repoPath: '/tmp/repos',
port: 7000,
httpApi: true
}
_git = new GitServer(options);