Revert authentication payload change
parent: tbd commit: 16b4bc2
1 | use Error; |
2 | use ; |
3 | use |
4 | , | AuthenticationTokenGranter
5 | |
6 | , DatabaseSettings, UserAuth, RepositoryBackend, UserBackend, | GitBackend
7 | , |
8 | , |
9 | , | InstanceConnections
10 | ; |
11 | use Instance; |
12 | use ; |
13 | use ; |
14 | use |
15 | , | File
16 | , |
17 | , |
18 | , | Mutex
19 | ; |
20 | use ; |
21 | use Table; |
22 | |
23 | |
24 | extern crate tracing; |
25 | |
26 | |
27 | async |
28 | ; | init
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 mut listener = bind .await?; |
36 | let connections: = default; |
37 | let instance_connections: = default; |
38 | let db_conn_options = new |
39 | .host |
40 | .port |
41 | .database |
42 | .username |
43 | .password |
44 | .log_statements; |
45 | let db_pool = connect_with .await?; |
46 | |
47 | debug!; |
48 | ! .run .await?; | migrate
49 | info!; |
50 | |
51 | let settings = new |
52 | pg_pool: db_pool.clone, |
53 | ; |
54 | |
55 | let repository_backend: = |
56 | new |
57 | pg_pool: db_pool.clone, |
58 | repository_folder: String from |
59 | config |
60 | .as_str |
61 | .unwrap, |
62 | , |
63 | instance: from_str |
64 | .unwrap, |
65 | ; |
66 | |
67 | let token_granter = new |
68 | config: config.clone, |
69 | instance: from_str .unwrap, |
70 | ; |
71 | |
72 | let user_backend: = new |
73 | db_pool.clone, |
74 | & from_str .unwrap, |
75 | token_granter.clone, |
76 | settings.clone, |
77 | ; |
78 | |
79 | info!; |
80 | |
81 | loop |
82 | let stream = accept_stream .await; |
83 | info!; |
84 | |
85 | let = match stream |
86 | Ok => stream, |
87 | Err => |
88 | error!; |
89 | continue; |
90 | |
91 | ; |
92 | |
93 | info!; |
94 | |
95 | let connection = accept_websocket_connection .await; |
96 | |
97 | let connection = match connection |
98 | Ok => connection, |
99 | Err => |
100 | error! |
101 | "Failed to initiate Websocket connection from {}. {:?}", |
102 | address, err |
103 | ; |
104 | continue; |
105 | |
106 | ; |
107 | |
108 | info!; |
109 | |
110 | let connection = RawConnection |
111 | task: spawn |
112 | connection, |
113 | connections.clone, |
114 | repository_backend.clone, |
115 | user_backend.clone, |
116 | token_granter.clone, |
117 | settings.clone, |
118 | address, |
119 | unwrap, | from_str .
120 | instance_connections.clone, |
121 | config.clone, |
122 | , |
123 | ; |
124 | |
125 | connections.lock .await.connections.push; |
126 | |
127 | |
128 | |
129 | async |
130 | let stream = listener.accept .await?; |
131 | |
132 | Ok |
133 | |
134 | |
135 | async |
136 | stream: S, |
137 | |
138 | let connection = accept_async .await?; |
139 | |
140 | Ok |
141 | |
142 |