Skip to content

Commit

Permalink
Remove config package and move classes elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesname committed Aug 20, 2024
1 parent c699bab commit 48cacc0
Show file tree
Hide file tree
Showing 36 changed files with 37 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/ErrorHandler.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import auth.handler.AuthHandler
import config.AppConfig
import views.AppConfig
import controllers.api.v1.ApiV1
import controllers.renderError
import cookies.{SessionPreferences, SessionPrefs}
Expand Down
2 changes: 1 addition & 1 deletion app/guice/SearchModule.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package guice

import com.google.inject.AbstractModule
import config.ServiceConfig
import eu.ehri.project.indexing.index.Index
import eu.ehri.project.indexing.index.impl.SolrIndex
import eu.ehri.project.search.solr._
import services.ServiceConfig
import services.search._

import javax.inject.{Inject, Provider}
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ val webAppSettings = Seq(

// Classes to auto-import into templates
Compile / templateImports ++= Seq(
"config._",
"views.AppConfig",
"cookies._",
),

Expand Down
2 changes: 1 addition & 1 deletion modules/admin/app/services/ingest/WSIngestService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import akka.stream.Materializer
import akka.stream.scaladsl.{FileIO, Source}
import akka.util.ByteString
import com.fasterxml.jackson.databind.JsonMappingException
import config.ServiceConfig
import models._
import play.api.cache.AsyncCacheApi
import play.api.http.{HeaderNames, MimeTypes}
import play.api.libs.Files.SingletonTemporaryFileCreator
import play.api.libs.json._
import play.api.libs.ws.{BodyWritable, SourceBody, WSClient}
import play.api.{Configuration, Logger}
import services.ServiceConfig
import services.data.{Constants, DataUser}
import services.redirects.MovedPageLookup
import services.search.{SearchConstants, SearchIndexMediator, SearchIndexMediatorHandle}
Expand Down
2 changes: 1 addition & 1 deletion modules/api/app/controllers/api/graphql/GraphQL.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package controllers.api.graphql

import akka.util.ByteString
import config.ServiceConfig
import controllers.AppComponents
import controllers.portal.base.PortalController
import play.api.http.{ContentTypes, HeaderNames, HttpVerbs}
import play.api.libs.ws.WSClient
import play.api.mvc.{Action, AnyContent, ControllerComponents, RawBuffer}
import services.ServiceConfig
import services.data.Constants

import javax.inject.{Inject, Singleton}
Expand Down
2 changes: 1 addition & 1 deletion modules/api/app/controllers/api/oaipmh/OaiPmhHome.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package controllers.api.oaipmh

import akka.util.ByteString
import config.ServiceConfig
import controllers.AppComponents
import controllers.portal.base.PortalController
import play.api.http.{ContentTypes, HttpVerbs}
import play.api.libs.ws.WSClient
import play.api.mvc._
import services.ServiceConfig

import javax.inject.{Inject, Singleton}

Expand Down
2 changes: 1 addition & 1 deletion modules/api/app/controllers/api/v1/ApiV1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package controllers.api.v1

import akka.stream.Materializer
import auth.handler.AuthHandler
import config.AppConfig
import views.AppConfig
import controllers.AppComponents
import controllers.base.{ControllerHelpers, CoreActionBuilders, SearchRelated, SearchVC}
import controllers.generic.Search
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package services

import play.api.Configuration
import play.api.http.HeaderNames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import akka.stream.alpakka.json.scaladsl.JsonReader
import akka.stream.scaladsl.Source
import akka.stream.{Materializer, scaladsl}
import akka.util.ByteString
import config.ServiceConfig
import play.api.Logger
import play.api.cache.SyncCacheApi
import play.api.http.HttpVerbs
import play.api.libs.functional.syntax._
import play.api.libs.json.{JsValue, Json, Reads, __}
import play.api.libs.ws.{WSClient, WSRequest}
import services.ServiceConfig
import services.data.Constants.STREAM_HEADER_NAME

import javax.inject.{Inject, Singleton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package services.data

import com.fasterxml.jackson.core.JsonParseException
import com.fasterxml.jackson.databind.JsonMappingException
import config.ServiceConfig
import play.api.Logger
import play.api.http._
import play.api.libs.json._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package auth.handler.cookie

import javax.inject.Inject
import auth.handler.TokenAccessor
import config.AppConfig
import views.AppConfig
import play.api.Configuration
import play.api.libs.crypto.CookieSigner
import play.api.mvc.Cookie.SameSite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package controllers.base

import akka.stream.scaladsl.Flow
import auth.handler.AuthHandler
import config.AppConfig
import views.AppConfig
import lifecycle.ItemLifecycle
import models.{Account, ContentTypes, PermissionType, UserProfile}
import play.api.mvc.WebSocket.MessageFlowTransformer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package controllers.generic

import config.AppConfig
import views.AppConfig
import controllers.base.CoreActionBuilders
import play.api.mvc.Request
import services.data.Constants
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package views

import models.EntityType
import play.api.Configuration
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/controllers/AppComponents.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controllers
import akka.stream.Materializer
import auth.handler.AuthHandler
import com.google.inject.ImplementedBy
import config.AppConfig
import views.AppConfig
import lifecycle.ItemLifecycle
import play.api.Configuration
import play.api.cache.SyncCacheApi
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/controllers/package.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import config.AppConfig
import views.AppConfig
import models.UserProfile
import play.api.i18n.Messages
import play.api.mvc.RequestHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package controllers.portal.base

import akka.http.scaladsl.model.Uri
import auth.handler.AuthHandler
import config.AppConfig
import views.AppConfig
import controllers.base.{ControllerHelpers, CoreActionBuilders}
import controllers.{AppComponents, renderError}
import cookies.{SessionPreferences, SessionPrefs}
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/forms/AccountForms.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package forms

import auth.oauth2.OAuth2Config
import config.AppConfig
import views.AppConfig

import javax.inject.{Inject, Singleton}
import models.SignupData
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/guice/AppModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import akka.actor.ActorSystem
import akka.stream.Materializer
import com.google.inject.AbstractModule
import com.google.inject.name.Names
import config.AppConfig
import views.AppConfig
import data.markdown.{CommonmarkMarkdownRenderer, RawMarkdownRenderer, SanitisingMarkdownRenderer}
import lifecycle.{GeocodingItemLifecycle, ItemLifecycle}
import play.api.libs.concurrent.AkkaGuiceSupport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import akka.stream.Materializer
import akka.stream.scaladsl.{Flow, Keep, Sink, Source}
import akka.util.ByteString
import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper}
import config.ServiceConfig
import eu.ehri.project.indexing.converter.impl.JsonConverter
import models.EntityType
import play.api.libs.json.Json
Expand All @@ -26,6 +25,7 @@ import javax.inject.Inject
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success, Try}
import org.apache.commons.lang3.time.DurationFormatUtils.formatDurationWords
import services.ServiceConfig


case class AkkaStreamsIndexMediator @Inject()(actorSystem: ActorSystem, mat: Materializer, config: Configuration, executionContext: ExecutionContext) extends
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package services.search

import akka.actor.ActorRef
import com.google.common.collect.EvictingQueue
import config.ServiceConfig
import models.EntityType
import play.api.{Configuration, Logger}
import services.ServiceConfig
import services.data.Constants

import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package services.search

import akka.actor.{ActorRef, ActorSystem}
import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper, ObjectWriter}
import config.ServiceConfig
import eu.ehri.project.indexing.Pipeline.Builder
import eu.ehri.project.indexing.converter.impl.JsonConverter
import eu.ehri.project.indexing.index.Index
Expand All @@ -11,6 +10,7 @@ import eu.ehri.project.indexing.source.impl.WebJsonSource
import eu.ehri.project.indexing.{IndexHelper, Pipeline}
import models.EntityType
import play.api.Logger
import services.ServiceConfig
import services.data.Constants

import java.util.Properties
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: AuthoritativeSet, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: AuthoritativeSet, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@views.html.common.itemDetails {
@views.html.common.rightSidebar {
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/views/concept/itemDetails.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: Concept, annotations: Seq[Annotation], result: services.search.SearchResult[(Model, services.search.SearchHit)], action: Call, watched: Seq[String], dlid: Option[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: Concept, annotations: Seq[Annotation], result: services.search.SearchResult[(Model, services.search.SearchHit)], action: Call, watched: Seq[String], dlid: Option[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@views.html.common.itemDetails {
@defining("cvocConcept") { implicit fieldPrefix =>
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/views/country/itemDetails.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: Country, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: Country, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@import CountryF._
@import views.html.common.textField
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: DocumentaryUnit, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String], dlid: Option[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: DocumentaryUnit, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String], dlid: Option[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@views.html.common.itemDetails {
@defining("documentaryUnit") { implicit fieldPrefix =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: HistoricalAgent, annotations: Seq[Annotation], result: services.search.SearchResult[(Model, services.search.SearchHit)], action: Call, watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: HistoricalAgent, annotations: Seq[Annotation], result: services.search.SearchResult[(Model, services.search.SearchHit)], action: Call, watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@views.html.common.itemDetails {
@defining("historicalAgent") { implicit fieldPrefix =>
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/views/repository/itemDetails.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: Repository, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], req: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: Repository, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], req: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@views.html.common.itemDetails {
@defining("repository") { implicit fieldPrefix =>
Expand Down
2 changes: 1 addition & 1 deletion modules/portal/app/views/vocabulary/itemDetails.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(item: Vocabulary, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: config.AppConfig, messages: Messages, md: MarkdownRenderer)
@(item: Vocabulary, annotations: Seq[Annotation], links: Seq[Link], watched: Seq[String])(implicit userOpt: Option[UserProfile], request: RequestHeader, prefs: cookies.SessionPrefs, conf: views.AppConfig, messages: Messages, md: MarkdownRenderer)

@views.html.common.itemDetails {
@views.html.common.rightSidebar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package eu.ehri.project.search.solr

import config.ServiceConfig
import play.api.libs.json.JsString
import play.api.libs.ws.{WSClient, WSResponse}
import play.api.{Configuration, Logger}
import services.ServiceConfig
import services.data.BadJson
import services.search.{SearchHit, _}
import services.search._
import utils.Page

import java.net.ConnectException
Expand Down
2 changes: 1 addition & 1 deletion test/actors/harvesting/HarvesterManagerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import actors.harvesting.OaiPmhHarvester.{OaiPmhHarvestData, OaiPmhHarvestJob}
import actors.harvesting.ResourceSyncHarvester.{ResourceSyncData, ResourceSyncJob}
import actors.harvesting.UrlSetHarvester.{UrlSetHarvesterData, UrlSetHarvesterJob}
import akka.actor.{ActorContext, Props}
import config.ServiceConfig
import helpers.IntegrationTestRunner
import mockdata.adminUserProfile
import models.HarvestEvent.HarvestEventType
import models._
import play.api.i18n.{Lang, Messages, MessagesApi}
import play.api.libs.ws.WSClient
import play.api.{Application, Configuration}
import services.ServiceConfig
import services.harvesting.{MockHarvestEventService, OaiPmhClient, ResourceSyncClient}
import services.storage.FileStorage
import utils.WebsocketConstants
Expand Down
2 changes: 1 addition & 1 deletion test/actors/harvesting/OaiPmhHarvesterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import actors.LongRunningJob.Cancel
import actors.harvesting
import actors.harvesting.OaiPmhHarvester.{OaiPmhHarvestData, OaiPmhHarvestJob}
import akka.actor.Props
import config.ServiceConfig
import helpers.IntegrationTestRunner
import mockdata.adminUserProfile
import models.{OaiPmhConfig, BasicAuthConfig, UserProfile}
import play.api.{Application, Configuration}
import services.ServiceConfig
import services.harvesting.OaiPmhClient
import services.storage.FileStorage

Expand Down
2 changes: 1 addition & 1 deletion test/actors/harvesting/UrlSetHarvesterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import actors.LongRunningJob.Cancel
import actors.harvesting
import actors.harvesting.UrlSetHarvester.{UrlSetHarvesterData, UrlSetHarvesterJob}
import akka.actor.Props
import config.ServiceConfig
import helpers.IntegrationTestRunner
import mockdata.adminUserProfile
import models.{BasicAuthConfig, UrlSetConfig, UserProfile}
import play.api.libs.ws.WSClient
import play.api.{Application, Configuration}
import services.ServiceConfig
import services.storage.FileStorage

class UrlSetHarvesterSpec extends IntegrationTestRunner {
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/TestConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import akka.util.Timeout
import auth.handler.cookie.CookieIdContainer
import auth.handler.{AuthHandler, AuthIdContainer}
import auth.oauth2.MockOAuth2Service
import config.ServiceConfig
import cookies.SessionPreferences
import models.{Account, CypherQuery, Feedback}
import org.jsoup.Jsoup
Expand All @@ -24,6 +23,7 @@ import play.api.mvc.{AnyContentAsFormUrlEncoded, Request, Session}
import play.api.test.Helpers._
import play.api.test._
import play.api.{Application, Configuration}
import services.ServiceConfig
import services.accounts.{AccountManager, MockAccountManager}
import services.cypher.{CypherQueryService, MockCypherQueryService}
import services.data._
Expand All @@ -34,7 +34,7 @@ import services.htmlpages.{HtmlPages, MockHtmlPages}
import services.ingest.{EadValidator, MockEadValidatorService}
import services.oauth2.OAuth2Service
import services.redirects.{MockMovedPageLookup, MovedPageLookup}
import services.search.{MockSearchIndexMediator, _}
import services.search._
import utils.MockBufferedMailer

import java.nio.file.Paths
Expand Down
2 changes: 1 addition & 1 deletion test/integration/admin/HarvestConfigsSpec.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package integration.admin

import config.ServiceConfig
import helpers._
import models._
import play.api.libs.json.Json
import play.api.test.FakeRequest
import play.api.{Application, Configuration}
import services.ServiceConfig

import java.time.Instant
import java.time.temporal.ChronoUnit
Expand Down
2 changes: 1 addition & 1 deletion test/services/harvesting/WSOaiPmhClientSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package services.harvesting

import akka.stream.scaladsl.Sink
import akka.util.ByteString
import config.ServiceConfig
import helpers.TestConfiguration
import models.OaiPmhIdentity.Granularity
import models.{OaiPmhConfig, BasicAuthConfig, OaiPmhIdentity}
import org.w3c.dom.Element
import play.api.test.PlaySpecification
import play.api.{Application, Configuration}
import services.ServiceConfig

import java.io.StringWriter
import scala.xml.XML
Expand Down

0 comments on commit 48cacc0

Please sign in to comment.