Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small glitches for listing devices #264

Merged
merged 2 commits into from Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/instance/instance.go
Expand Up @@ -291,6 +291,11 @@ func (i *Instance) createAppsDB() error {
return couchdb.CreateDB(i, consts.Manifests)
}

// createClientsDB creates the database needed for OAuth 2 clients
func (i *Instance) createClientsDB() error {
return couchdb.CreateDB(i, consts.OAuthClients)
}

// createSettings creates the settings database and some documents like the
// default theme
func (i *Instance) createSettings() error {
Expand Down Expand Up @@ -369,6 +374,11 @@ func Create(opts *Options) (*Instance, error) {
return nil, err
}

err = i.createClientsDB()
if err != nil {
return nil, err
}

err = i.createSettings()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/oauth/client.go
Expand Up @@ -32,7 +32,7 @@ type Client struct {
CouchRev string `json:"_rev,omitempty"` // Generated by CouchDB

ClientID string `json:"client_id,omitempty"` // Same as CouchID
ClientSecret string `json:"client_secret"` // Generated by the server
ClientSecret string `json:"client_secret,omitempty"` // Generated by the server
SecretExpiresAt int `json:"client_secret_expires_at"` // Forced by the server to 0 (no expiration)
RegistrationToken string `json:"registration_access_token,omitempty"` // Generated by the server

Expand Down
2 changes: 1 addition & 1 deletion web/settings/settings_test.go
Expand Up @@ -272,7 +272,7 @@ func TestListClients(t *testing.T) {
assert.Equal(t, client.PolicyURI, attrs["policy_uri"].(string))
assert.Equal(t, client.SoftwareID, attrs["software_id"].(string))
assert.Equal(t, client.SoftwareVersion, attrs["software_version"].(string))
assert.Equal(t, "", attrs["client_secret"].(string))
assert.Nil(t, attrs["client_secret"])
}

func TestMain(m *testing.M) {
Expand Down