Update release system
All checks were successful
Build & Test / nix-build (push) Successful in 1m45s
All checks were successful
Build & Test / nix-build (push) Successful in 1m45s
This commit is contained in:
parent
2ef24bbe51
commit
5743ae55e0
@ -245,10 +245,10 @@ defmodule Amethyst.ConnectionHandler do
|
||||
end
|
||||
rescue
|
||||
e ->
|
||||
if Mix.env() == :dev do
|
||||
if Application.get_env(:amethyst, :release, false) do
|
||||
send(self(), {:disconnect, "§cError handling packet #{inspect(id, base: :hex)}:\n#{Exception.format(:error, e, __STACKTRACE__)}"})
|
||||
Logger.error("Error handling packet with ID #{inspect(id, base: :hex)} in state #{connstate}: #{Exception.format(:error, e, __STACKTRACE__)}")
|
||||
else
|
||||
send(self(), {:disconnect, "§cError handling packet #{inspect(id, base: :hex)}:\n#{Exception.format(:error, e, __STACKTRACE__)}"})
|
||||
Logger.error("Error handling packet with ID #{inspect(id, base: :hex)} in state #{connstate}: #{Exception.format(:error, e, __STACKTRACE__)}")
|
||||
end
|
||||
state
|
||||
|
@ -28,7 +28,8 @@ defmodule Amethyst.ConnectionState.Macros do
|
||||
defmacro defpacket_clientbound(name, id, version, signature, where \\ true) do
|
||||
quote do
|
||||
def serialize(%{packet_type: unquote(name)} = packet, unquote(version)) when unquote(where) do
|
||||
if Amethyst.ConnectionState.Macros.check_type(packet, unquote(signature)) do
|
||||
# Don't check types if we are in release mode
|
||||
if Application.get_env(:amethyst, :release, false) || Amethyst.ConnectionState.Macros.check_type(packet, unquote(signature)) do
|
||||
Amethyst.Minecraft.Write.varint(unquote(id)) <> Amethyst.ConnectionState.Macros.write_signature(packet, unquote(signature))
|
||||
else
|
||||
raise "Invalid packet type for #{unquote(name)}! Got #{inspect(packet)}"
|
||||
|
@ -6,4 +6,5 @@ config :amethyst,
|
||||
auth: true, # Whether or not users should be authenticated with Mojang.
|
||||
session_server: "https://sessionserver.mojang.com", # Base URL to the Mojang session server
|
||||
compression: 256, # Packets larger than this amount are sent compressed. Set to nil to disable compression.
|
||||
default_game: Example.Game # Which game new players should be sent to
|
||||
default_game: Example.Game, # Which game new players should be sent to
|
||||
release: config_env() == :prod # If this is set to false, Amethyst will perform additional checks at runtime and will handle errors more loosely
|
||||
|
17
flake.nix
17
flake.nix
@ -43,14 +43,20 @@
|
||||
})
|
||||
);
|
||||
|
||||
#secrets = import ./secrets.nix;
|
||||
|
||||
package = env: pkgs: (pkgs.beamPackages.mixRelease {
|
||||
package = env: release: pkgs: (pkgs.beamPackages.mixRelease {
|
||||
pname = "amethyst";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
elixir = pkgs.elixir;
|
||||
mixEnv = env;
|
||||
mixReleaseName = release;
|
||||
# This should just be part of mixRelease, I don't know why we need to do it here
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mix release ${release} --no-deps-check --path "$out"
|
||||
runHook postInstall
|
||||
'';
|
||||
meta.mainProgram = "${release}";
|
||||
erlangDeterministicBuilds = false; # Technically less pure but allows doctests
|
||||
removeCookie = false; # Insecure; Access to the file system can allow the cookie to be read and provides remote control of the Erlang VM
|
||||
mixNixDeps = import ./mix.nix {inherit lib; beamPackages = pkgs.beamPackages;};
|
||||
@ -64,8 +70,9 @@
|
||||
in {
|
||||
packages = eachSystem (pkgs:
|
||||
{
|
||||
default = package "prod" pkgs;
|
||||
dev = package "dev" pkgs;
|
||||
default = package "prod" "amethyst" pkgs;
|
||||
dev = package "dev" "amethyst" pkgs;
|
||||
example = package "prop" "example" pkgs;
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user