sbt-revolver | SBT plugin for dangerously fast development turnaround | Build Tool library
kandi X-RAY | sbt-revolver Summary
kandi X-RAY | sbt-revolver Summary
sbt-revolver is a plugin for SBT enabling a super-fast development turnaround for your Scala applications.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sbt-revolver
sbt-revolver Key Features
sbt-revolver Examples and Code Snippets
Community Discussions
Trending Discussions on sbt-revolver
QUESTION
I have a ConfigLoader which I'm pretty sure works fine. I suspect I am not using application.conf file correctly or perhaps my directory containing the prd.env and dev.env is not in the correct place.
What I expect to happen:
I when I enter sbt run
the ConfigLoader reads the application.conf file, sees there are variables within that file. Then checks if prd.env or dev.env depending on which environment it is in and then finally loads the variables. I want this so I can have a different database for dev and prd.
- I have not idea how it would find the Meta directory which contains the prd.env and dev.env (see image).
- I have no idea how it would be able to tell whether if the environment is in dev or prd.
- The goal is to now look towards deploying this app, which is why I need these environment variables to work.
I really appreciate all the help but please try and detail your answers because I am really stuck and short answers often assume I know more than I do. Thanks :)
Tech stack incase relevant:
- HTTP4S,
- CATS,
- Doobie,
- PostgreSQL
application.conf file below:
...ANSWER
Answered 2021-Jan-16 at 16:34When running via sbt run
, the environment is set by the shell in which you're running sbt. Defining a dev.env
file by itself does nothing.
The mechanism for setting the environment in which sbt is running will vary depending on your shell.
For example if bash is your shell (this is worth trying in other Bourne-compatible shells), prefixing the environment variables with export
, e.g.:
QUESTION
my e2e test task sends some http requests to the server. i want to start that server (Play framework based) on a separate jvm, then start the test which hits the server and let it finish, then stop the server.
i looked through many SO threads so far found these options:
- use sbt-sequential
- use sbt-revolver
- use alias
but in my experiments setting fork doesn't work, i.e. it still blocks execution when server is started
...ANSWER
Answered 2020-Sep-17 at 14:44fork
doesn't run task in parallel - it just makes sure that tests are run in a separate JVM which helps with things like shutdown webhooks or disconnecting from services that doesn't handle resource release properly (e.g. DB connection that never calls disconnect).
If you want to use the same sbt to start server AND run test against that instance (which sounds like easily breakable antipattern BTW) you can use somethings like:
reStart
it:test
reStop
However that would be tricky because reStart
yields immediately so tests would start when the server setup started but not necessarily completed. Race condition, failing tests, or blocking all tests until server finishes starting.
This is why nobody does it. Much easier to handle solution is to:
- start the server in test in some
beforeAll
method and make this method complete only after server is responding to queries - shutdown it in some
afterAll
method (or somehow handle both of these using something likecats.effect.Resource
or similar) - depending on situation:
- running tests sequentially to avoid starting two instances at the same time or
- generating config for each test so that they could be run in parallel without clashing on ports allocations
Anything else is just a hack that is going to fail sooner rather than later.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sbt-revolver
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page