Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
217 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package tech.beshu.ror | ||
|
||
import monix.eval.Task | ||
import tech.beshu.ror.acl.factory.AsyncHttpClientsFactory | ||
import tech.beshu.ror.acl.logging.AuditSink | ||
import tech.beshu.ror.acl.{Acl, AclStaticContext} | ||
|
||
object RorEngine { | ||
|
||
def start(auditSink: AuditSink): Task[Engine] = ??? | ||
} | ||
|
||
final class Engine(val acl: Acl, val context: AclStaticContext, httpClientsFactory: AsyncHttpClientsFactory) { | ||
def shutdown(): Unit = { | ||
httpClientsFactory.shutdown() | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
core/src/main/scala/tech/beshu/ror/acl/utils/ScalaJavaHelper.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
core/src/main/scala/tech/beshu/ror/acl/utils/YamlOps.scala
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
core/src/main/scala/tech/beshu/ror/configuration/ConfigLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package tech.beshu.ror.configuration | ||
|
||
import monix.eval.Task | ||
|
||
trait ConfigLoader { | ||
|
||
def load(): Task[RawRorConfig] | ||
} |
8 changes: 8 additions & 0 deletions
8
core/src/main/scala/tech/beshu/ror/configuration/FileConfigLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package tech.beshu.ror.configuration | ||
|
||
import monix.eval.Task | ||
import tech.beshu.ror.utils.EnvVarsProvider | ||
|
||
class FileConfigLoader(envVarsProvider: EnvVarsProvider) extends ConfigLoader { | ||
override def load(): Task[RawRorConfig] = ??? | ||
} |
7 changes: 7 additions & 0 deletions
7
core/src/main/scala/tech/beshu/ror/configuration/IndexConfigLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package tech.beshu.ror.configuration | ||
|
||
import monix.eval.Task | ||
|
||
class IndexConfigLoader extends ConfigLoader { | ||
override def load(): Task[RawRorConfig] = ??? | ||
} |
24 changes: 24 additions & 0 deletions
24
core/src/main/scala/tech/beshu/ror/configuration/RawRorConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package tech.beshu.ror.configuration | ||
|
||
import org.yaml.snakeyaml.Yaml | ||
import tech.beshu.ror.acl.factory.CoreFactory.AclCreationError.Reason.Message | ||
import tech.beshu.ror.acl.factory.CoreFactory.AclCreationError.{ReadonlyrestSettingsCreationError, UnparsableYamlContent} | ||
import tech.beshu.ror.acl.factory.CoreFactory.{AclCreationError, Attributes} | ||
|
||
import scala.util.{Failure, Success, Try} | ||
|
||
final case class RawRorConfig private (validatedRorYaml: String) { | ||
|
||
private def trimToRorPartOnly(settingsYamlString: String): Either[AclCreationError, String] = { | ||
val yaml = new Yaml() | ||
Try(yaml.load[java.util.Map[String, Object]](settingsYamlString)) match { | ||
case Success(map) => | ||
Option(map.get("readonlyrest")).map(yaml.dump) match { // todo: "readonlyrest" from const | ||
case Some(value) => Right(value) | ||
case None => Left(ReadonlyrestSettingsCreationError(Message(s"No ${"readonlyrest"} section found"))) // fixme: | ||
} | ||
case Failure(ex) => | ||
Left(UnparsableYamlContent(Message(s"Malformed: $settingsYamlString"))) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
core/src/main/scala/tech/beshu/ror/utils/EnvVarsProvider.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package tech.beshu.ror.utils | ||
|
||
import scala.util.Try | ||
|
||
trait EnvVarsProvider { | ||
def getEnv(name: String): Option[String] | ||
} | ||
|
||
object JavaEnvVarsProvider extends EnvVarsProvider { | ||
override def getEnv(name: String): Option[String] = | ||
Try(Option(System.getenv(name))).toOption.flatten | ||
} |
Oops, something went wrong.