Add users table
parent: tbd commit: 9f36e3f
1 | use ; |
2 | |
3 | use ; |
4 | use |
5 | , | AuthenticationTokenGranter
6 | , |
7 | connection, listener, |
8 | ; |
9 | use Listeners; |
10 | use ; |
11 | use |
12 | , | File
13 | , |
14 | , |
15 | , | Mutex
16 | ; |
17 | use ; |
18 | use Table; |
19 | |
20 | |
21 | extern crate tracing; |
22 | |
23 | |
24 | async |
25 | ; | init
26 | let mut listener = bind .await?; |
27 | let connections: = default; |
28 | let listeners: = default; |
29 | let config: Table = |
30 | let mut file = open .await?; |
31 | let mut text = String new; |
32 | file.read_to_string .await?; |
33 | text.parse? |
34 | ; |
35 | let db_conn_options = new |
36 | .host |
37 | .port |
38 | .database |
39 | .username |
40 | .password |
41 | .log_statements; |
42 | let db_pool = connect_with .await?; |
43 | |
44 | debug!; |
45 | ! .run .await?; | migrate
46 | info!; |
47 | |
48 | let repository_backend: = new |
49 | let foo: GitBackend = GitBackend |
50 | pg_pool: db_pool.clone, |
51 | repository_folder: String from |
52 | config |
53 | .as_str |
54 | .unwrap, |
55 | , |
56 | ; |
57 | foo |
58 | ; |
59 | |
60 | let user_backend: = |
61 | ; | new
62 | |
63 | let token_granter = new |
64 | config: config.clone, |
65 | ; |
66 | |
67 | info!; |
68 | |
69 | loop |
70 | let stream = accept_stream .await; |
71 | info!; |
72 | |
73 | let = match stream |
74 | Ok => stream, |
75 | Err => |
76 | error!; |
77 | continue; |
78 | |
79 | ; |
80 | |
81 | info!; |
82 | |
83 | let connection = accept_websocket_connection .await; |
84 | |
85 | let connection = match connection |
86 | Ok => connection, |
87 | Err => |
88 | error! |
89 | "Failed to initiate Websocket connection from {}. {:?}", |
90 | address, err |
91 | ; |
92 | continue; |
93 | |
94 | ; |
95 | |
96 | info!; |
97 | |
98 | let connection = RawConnection |
99 | task: spawn |
100 | connection, |
101 | listeners.clone, |
102 | connections.clone, |
103 | repository_backend.clone, |
104 | user_backend.clone, |
105 | token_granter.clone, |
106 | address, |
107 | , |
108 | ; |
109 | |
110 | connections.lock .await.connections.push; |
111 | |
112 | |
113 | |
114 | async |
115 | listener: &mut TcpListener, |
116 | |
117 | let stream = listener.accept .await?; |
118 | |
119 | Ok |
120 | |
121 | |
122 | async |
123 | stream: S, |
124 | |
125 | let connection = accept_async .await?; |
126 | |
127 | Ok |
128 | |
129 |