Update to match new configuration structure

This commit is contained in:
Dane Everitt 2020-04-10 15:22:15 -07:00
parent 62ed90e621
commit ac9ab4c0b0
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
3 changed files with 12 additions and 7 deletions

View File

@ -32,7 +32,7 @@ func (r *PanelRequest) GetClient() *http.Client {
func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request { func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request {
req.Header.Set("Accept", "application/vnd.pterodactyl.v1+json") req.Header.Set("Accept", "application/vnd.pterodactyl.v1+json")
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+config.Get().AuthenticationToken) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s.%s", config.Get().AuthenticationTokenId, config.Get().AuthenticationToken))
return req return req
} }

View File

@ -21,6 +21,17 @@ type Configuration struct {
// if the debug flag is passed through the command line arguments. // if the debug flag is passed through the command line arguments.
Debug bool Debug bool
// A unique identifier for this node in the Panel.
Uuid string
// An identifier for the token which must be included in any requests to the panel
// so that the token can be looked up correctly.
AuthenticationTokenId string `yaml:"token_id"`
// The token used when performing operations. Requests to this instance must
// validate against it.
AuthenticationToken string `yaml:"token"`
Api ApiConfiguration Api ApiConfiguration
System SystemConfiguration System SystemConfiguration
Docker DockerConfiguration Docker DockerConfiguration
@ -55,10 +66,6 @@ type Configuration struct {
// The location where the panel is running that this daemon should connect to // The location where the panel is running that this daemon should connect to
// to collect data and send events. // to collect data and send events.
PanelLocation string `yaml:"remote"` PanelLocation string `yaml:"remote"`
// The token used when performing operations. Requests to this instance must
// validate against it.
AuthenticationToken string `yaml:"token"`
} }
// Defines basic system configuration settings. // Defines basic system configuration settings.

2
go.mod
View File

@ -29,7 +29,6 @@ require (
github.com/gbrlsnchs/jwt/v3 v3.0.0-rc.0 github.com/gbrlsnchs/jwt/v3 v3.0.0-rc.0
github.com/ghodss/yaml v1.0.0 github.com/ghodss/yaml v1.0.0
github.com/gin-gonic/gin v1.6.2 github.com/gin-gonic/gin v1.6.2
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/protobuf v1.3.5 // indirect github.com/golang/protobuf v1.3.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.1 github.com/google/uuid v1.1.1
@ -65,7 +64,6 @@ require (
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b // indirect golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect