File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,8 @@ fn main() {
117
117
let app = cargo_registry:: App :: new ( & config) ;
118
118
let app = cargo_registry:: middleware ( Arc :: new ( app) ) ;
119
119
120
- cargo_registry:: categories:: sync ( ) . unwrap ( ) ;
120
+ let categories_toml = include_str ! ( "../categories.toml" ) ;
121
+ cargo_registry:: categories:: sync ( & categories_toml) . unwrap ( ) ;
121
122
122
123
let port = if heroku {
123
124
8888
Original file line number Diff line number Diff line change @@ -98,15 +98,14 @@ struct NewCategory {
98
98
description : String ,
99
99
}
100
100
101
- pub fn sync ( ) -> CargoResult < ( ) > {
101
+ pub fn sync ( toml_str : & str ) -> CargoResult < ( ) > {
102
102
use diesel:: pg:: upsert:: * ;
103
103
use diesel:: expression:: dsl:: all;
104
104
105
105
let conn = db:: connect_now ( ) . unwrap ( ) ;
106
106
107
- let categories = include_str ! ( "./categories.toml" ) ;
108
107
let toml: toml:: value:: Table =
109
- toml:: from_str ( categories ) . expect ( "Could not parse categories. toml" ) ;
108
+ toml:: from_str ( toml_str ) . expect ( "Could not parse categories toml" ) ;
110
109
111
110
let categories = categories_from_toml ( & toml, None )
112
111
. expect ( "Could not convert categories from TOML" )
You can’t perform that action at this time.
0 commit comments