Skip to content

Commit

Permalink
Merge pull request #22 from hostari/pz-wipe-server
Browse files Browse the repository at this point in the history
Pz wipe server
  • Loading branch information
Weltinio authored Sep 28, 2022
2 parents 72f2296 + af0ea32 commit eb77fb7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: fleet_app_client
version: 0.2.0
version: 0.2.1

authors:
- Pauline De Polonia <[email protected]>
Expand Down
41 changes: 41 additions & 0 deletions src/fleet_app/wipe_world.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module FleetApp
class Server
# Wipes a Project Zomboid server's world.
#
# This is different from creating a game server. Starting a game server assumes that the
# server has already been created, and is starting from a stopped state.
#
# Use `host` to specify the queue name in brooce to send to.
# For example, use `2013191.xyz` if the command should be executed on tms1.
# If you don't know which queue to send to, the SRE lead should be able to advise you
# based on how they configured brooce.
#
# Use `game_name` to specify the game you are sending a brooce command for.
# See: `FleetApp::Game` for possible values.
#
# Use `server_id` to specify the internal Hostari id. Can be a `subscription_id` from GamesSite,
# or a `server_id` from VSH.
#
# `body` is an optional, JSON-formatted string that is sent as the request body which defaults to an empty string.
# This is used to override the default command in fleet app.
# For example, you can send this: `{command: "echo 'foobar'"}.to_json`
#
# `environment` is an optional string that specifies which fleet app to send the request to.
def self.wipe_world(host : String, game_name : String, server_id : String, body : String = "", environment : String = "production", username : String = "", world_name : String = "")
FleetApp::ClientWrapper.new(environment).post(
game_name: game_name,
path: ApiPath.new(game_name, server_id, host, username: username, action: "wipe_world").path,
body: body
)
end

def self.wipe_world_with_auth(host : String, game_name : String, server_id : String, basic_auth : String, body : String = "", environment : String = "production", username : String = "", world_name : String = "")
FleetApp::ClientWrapper.new(environment).post_with_auth(
game_name: game_name,
path: ApiPath.new(game_name, server_id, host, username: username, action: "wipe_world").path,
body: body,
basic_auth: basic_auth
)
end
end
end
2 changes: 1 addition & 1 deletion src/fleet_app_client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "json"
require "http/client"

class FleetAppClient
VERSION = "0.2.0"
VERSION = "0.2.1"
HOST = "fleet.hostari.com"
SANDBOX_HOST = "sandbox-#{HOST}"
end
Expand Down

0 comments on commit eb77fb7

Please sign in to comment.