Compare commits
2 commits
809e045c0b
...
e70714f257
Author | SHA1 | Date | |
---|---|---|---|
e70714f257 | |||
677269d4fc |
2 changed files with 22 additions and 2 deletions
|
@ -1,6 +1,11 @@
|
|||
# rwws - RealWeather Web Server
|
||||
|
||||
This contacts APIs instead of the servers because we scrape some, and we don't want to draw attention
|
||||
RealWeather Web Server is a web server that proxies requests to APIs that are used by [RealWeather](/Minecon724/RealWeather)
|
||||
|
||||
Good if you want to share your API key, but don't want to give it away, for example if you pay for it and want to resell \
|
||||
Also reduces load on the services that are "scraped" (only if many users share the same instance) \
|
||||
Or if you want to better firewall your server \
|
||||
Just use it
|
||||
|
||||
### Usage
|
||||
See `RUNNING.md`[^1]
|
||||
|
@ -10,4 +15,4 @@ See `PROTOCOL.md`
|
|||
|
||||
---
|
||||
|
||||
[^1]: This is the default Quarkus readme that I wish was available online
|
||||
[^1]: This is the default Quarkus readme that I wish was available online because it's so nice
|
|
@ -1,20 +1,35 @@
|
|||
package eu.m724;
|
||||
|
||||
import eu.m724.orm.Token;
|
||||
import io.quarkus.runtime.LaunchMode;
|
||||
import io.quarkus.runtime.StartupEvent;
|
||||
import jakarta.enterprise.event.Observes;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Base64;
|
||||
|
||||
@Singleton
|
||||
public class Startup {
|
||||
@Inject
|
||||
LaunchMode launchMode;
|
||||
|
||||
@Transactional
|
||||
public void loadUsers(@Observes StartupEvent ignoredEvent) {
|
||||
GlobalAccessLimits.initialize();
|
||||
Token.deleteAll();
|
||||
byte[] adminKey = new byte[18];
|
||||
System.out.printf("Launch mode: %s\n", launchMode.toString());
|
||||
|
||||
if (launchMode == LaunchMode.NORMAL) {
|
||||
System.out.println("Admin token is random");
|
||||
new SecureRandom().nextBytes(adminKey);
|
||||
} else {
|
||||
// I don't know, but let it be
|
||||
System.out.println("\n IF THIS IS RUNNING IN PRODUCTION, stop this program now and ask for help.\n");
|
||||
}
|
||||
|
||||
Token token = new Token();
|
||||
token.accessLimits = GlobalAccessLimits.kilo;
|
||||
|
|
Loading…
Reference in a new issue