You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 regels
1.9 KiB

  1. import Fluent
  2. import FluentPostgresDriver
  3. import Vapor
  4. // configures your application
  5. public func configure(_ app: Application) async throws {
  6. app.middleware.use(ErrorMiddleware.default(environment: app.environment))
  7. // uncomment to serve files from /Public folder
  8. // app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
  9. app.routes.defaultMaxBodySize = "128mb"
  10. // let timeout = HTTPClient.Configuration.Timeout(connect: .seconds(300), read: .seconds(300))
  11. // app.http.client.configuration.timeout = timeout
  12. app.databases.use(.postgres(hostname: "127.0.0.1", port: 5433, username: "mcarman", password: "@ng31F@rm0823262", database: "fueling"), as: .psql)
  13. // app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init(
  14. // hostname: Environment.get("DATABASE_HOST") ?? "localhost",
  15. // port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? 5433,
  16. // username: Environment.get("DATABASE_USERNAME") ?? "mcarman",
  17. // password: Environment.get("DATABASE_PASSWORD") ?? "@ng31F@rm0823262",
  18. // database: Environment.get("DATABASE_NAME") ?? "fueling",
  19. // tls: .disable)
  20. // ), as: .psql)
  21. app.http.server.configuration.port = 3002
  22. app.migrations.add(CreateFuelEntry())
  23. app.migrations.add(AddLatitudeAndLongitudeAndRemoveGpsLocationAndImage())
  24. app.migrations.add(AddImageBackIn())
  25. app.migrations.add(StoreImageDataInDatabase())
  26. app.migrations.add(AddDownloadedBool())
  27. app.migrations.add(CreateUser())
  28. app.migrations.add(CreateTokens())
  29. app.migrations.add(UpdateUser1())
  30. app.migrations.add(UpdateTokens1())
  31. app.migrations.add(UpdateUser2_AddTokenfield())
  32. app.migrations.add(UpdateUser3_RemoveTokenfield())
  33. app.migrations.add(AddLoadDateAndPullDate())
  34. try await app.autoMigrate().get()
  35. // register routes
  36. try routes(app)
  37. }