File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,4 +25,4 @@ COPY . .
2525EXPOSE 8000
2626
2727# Command to run the application.
28- CMD ["deno" , "run " , "start" ]
28+ CMD ["deno" , "task " , "start" ]
Original file line number Diff line number Diff line change @@ -13,24 +13,27 @@ interface TokenDoc {
1313
1414// Connect to MongoDB
1515const client = new MongoClient ( ) ;
16- client . connect ( Deno . env . get ( "MONGODB_URI" ) ! ) ; // Make sure to connect before using
16+ const mongo_uri = Deno . env . get ( "MONGODB_URI" ) ! ;
17+ await client . connect ( mongo_uri ) ; // Make sure to connect before using
1718
1819const db = client . database ( "ollama" ) ;
20+ const collection = db . collection < TokenDoc > ( "tokens" ) ;
1921
2022function removeTrailingSlash ( str : string ) : string {
2123 // Check if the string ends with a slash and remove it if present
2224 return str . endsWith ( "/" ) ? str . slice ( 0 , - 1 ) : str ;
2325}
2426
25- const ollama_url = removeTrailingSlash ( Deno . env . get ( "OLLAMA_URL" ) ! ) ;
27+ const ollama_url_unedited = Deno . env . get ( "OLLAMA_URL" ) ! ;
28+ const ollama_url = removeTrailingSlash ( ollama_url_unedited ) ;
2629
2730app . use ( logger ( ) ) ;
2831
2932app . use (
3033 "*" ,
3134 bearerAuth ( {
3235 verifyToken : async ( token , _c ) => {
33- const tokenDoc = await db . collection < TokenDoc > ( "tokens" ) . findOne ( {
36+ const tokenDoc = await collection . findOne ( {
3437 token,
3538 } ) ;
3639
You can’t perform that action at this time.
0 commit comments