Commit Graph

458 Commits

Author SHA1 Message Date
Scott Bishel
f548ecbee1 MM-27688-OpenId Connect (#16222)
* implement openid connect

* update error strings

* handle OpenIdSetting.Secret as FAKE SETTING

* add openid to telemetry

* update config defaults, add telemetry

* fix bug with Office365

* Retrieve Office365 AuthData from IdToken

* fix linter

* add feature flag, reset defaults for config

* fix build error

* fix unit tests

* add authentication permission to Feature
Flags

* turn off feature flag

* set default button color

* set default button color only on openid

* fix for merging FeatureFlags in config

* remove feature flag

* revert config changes

* remove debug statements

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 19:58:37 -07:00
Gabe Jackson
ab7c92a28b Limit configuration database connections (#16512)
When configuration is backed by a database, a separate pool of
connections is used for access from the primary database. This
change sets sensible config DB connection limits in order to
reduce database resource usage at scale.
2020-12-08 11:44:30 -05:00
Gabe Jackson
fe7d9f7643 Additional Config Store Cleanup (#16440)
This change addresses a few issues where config stores were not
properly closed when an error was encountered on server startup.
This could result in leaked database connections when dealing with
a database config store.
2020-12-03 10:09:31 -05:00
Sudheer
6cebcead22 MM-27989 Remove experimental setting for data prefetch (#16306)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 11:14:30 -05:00
Jesús Espino
a74fe05695 Removing supplier concept from the sql store (#16355)
* Removing supplier concept from the sql store

* Removing other metions to supplier

* Fixing gofmt

* Fixing gofmt

* Renaming NewSqlStore to New

* Fixing tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 12:06:23 +01:00
John Tzikas
3fdc6cb531 Fix misspellings and enable misspell on ci (#16285)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-12-01 16:27:05 +01:00
Christopher Speller
a87e8d1c20 MM-30740 Add support for boolean feature flags. (#16311)
* Add support for boolean feature flags.

* Tests

* Use strconv.ParseBool to accept additional values as true.

* Update config/feature_flags.go

Co-authored-by: Christopher Poile <cpoile@gmail.com>

Co-authored-by: Christopher Poile <cpoile@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-25 07:27:06 -08:00
Christopher Speller
ceb1422a5c MM-29709 Client side feature flags (#16212)
* Client side feature flags.

* Fix test.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-18 11:11:15 -08:00
Miguel de la Cruz
6c857a4525 [MM-30436] Add support for configuration custom defaults (#16265)
* [MM-30436] Add support for configuration custom defaults

* Addressing review comments

* Addressing PR comments

* Soft fail if the configuration defaults cannot be read

* Directly print error in log message

* Fix linter

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-16 15:25:48 +01:00
Harrison Healey
059672ba73 MM-30090 Add ManagedResourcePaths setting (#16213) 2020-11-05 11:07:03 -05:00
Christopher Speller
1aadd36644 MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* Add feature flag managment system using split.io and remove viper.

* Fixing tests.

* Attempt to fix postgres tests.

* Fix watch filepath for advanced logging.

* Review fixes.

* Some error wrapping.

* Remove unessisary store interface.

* Desanitize SplitKey

* Simplify.

* Review feedback.

* Rename split mlog adatper to split logger.

* fsInner

* Style.

* Restore oldcfg test.

* Downgrading non-actionable feature flag errors to warnings.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-29 15:54:39 -07:00
Maria A Nunez
7381b4c0e5 MM-27454 - Added CWSUrl to Client Config (#15916) 2020-10-12 22:46:22 -04:00
Ibrahim Serdar Acikgoz
40371d8616 config/envrionment: fix a panic where a setting is not defined in (#15819)
model.Config
2020-10-07 09:33:53 +03:00
Agniva De Sarker
0e90606547 MM-29011: Add feature flag for shared channels (#15585)
* MM-29011: Add feature flag for shared channels

https://mattermost.atlassian.net/browse/MM-29011

* gofmt

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-01 10:37:15 +05:30
Christopher Speller
e974b7b9be MM28858 Basic framework for use of feature flags. Enviroment variable overrides. (#15544)
* Basic framework for use of feature flags. Enviroment variable overrides.

* Use Apperr instead of error number increments.

* Undo random viper change.

* Update model/config_test.go

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2020-09-29 21:41:22 -07:00
Eli Yukelzon
4e9ddd4686 MM-27918 In-Product notices support (#15316) 2020-09-21 10:28:46 +03:00
Claudio Costa
334cf9d84a [MM-28131] Fix desanitization of DataSourceReplicas and DataSourceSearchReplicas (#15389)
* Fix desanitization of DataSourceReplicas and DataSourceSearchReplicas

* Fix test case

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-17 20:16:59 +02:00
Doug Lauder
1b67322fb9 MM-27744 disable Zap for unit tests. (#15398)
MM-27744 disable Zap for unit tests.

Zap has no concept of shutdown or close. Zap is only shutdown when the app exits. Not a problem for console logging, but when creating a new Zap logger that outputs to files on every unit test, that leaves no easy way to clean up until process exit. Depending on what else is running this can exhaust all file handles and cause unit tests to fail.

Zap is now disabled unit tests and uses Logr instead, regardless of config settings. `make test-server` peak file handle usage dropped from ~5K to less than 100.
2020-09-09 15:25:55 -04:00
Jesús Espino
44079785eb Moving diagnostics into a service (#14832)
* Moving diagnostics into a service

* Fixing golint checks

* Fixing tests

* Renaming from diagnostics to telemetry

* Adding missing files

* Initializing telemetry earlier in the server startup

* Fixing tests

* Adding a log for the telemetryID initialization error

* Addressing PR review comments

* Fixing merge problem

* Removing some extra Diagnostics mentions

* Making tests pass
2020-09-08 20:30:54 +02:00
Devin Binnie
c1ac3e69f0 [MM-28313] Add Cloud Billing feature flag (#15391) 2020-09-03 10:10:59 -04:00
Martin Kraft
c6b20ab133 MM-27525: Sanitizes gifycat's and Oauth secrets. (#15348) 2020-08-31 11:48:39 +05:30
Nick Misasi
4f0a33eea7 Change ExperimentalCloudUserLimit config to be base 10 (#15342) 2020-08-25 14:10:05 -04:00
Agniva De Sarker
94d09e1336 Fix return nil (#15330)
* Fix return nil

A nil error is an interface having nil value but a non-nil type.
This leads to unexpected errors in the code well-documented here:
https://golang.org/doc/faq#nil_error

We fix this by passing an additional parameter to handle it.

Caught using https://github.com/dgryski/semgrep-go

* Bring back auto-generated line
2020-08-24 11:16:35 +05:30
Martin Kraft
7cc26bf659 MM-27525: Obscure Global Relay's SMTP password. (#15228)
* MM-27525: Obscures the Global Relay SMTP password.

* MM-27525: Desanitize global relay's SMTP password.

* MM-27525: Does not set the fake value if the field is blank.
2020-08-20 09:01:22 -04:00
nickmisasi
769f39eee5 [MM-27535] User invite limits for MM Cloud (#15197)
* Add a config for MM User Limit

* Adding graceful errors for if an administrator invites people passed their user limit

* Including changed vendor files

* Adding unit test

* Fix a bug

* Push up working tests (Thanks Joram)

* Add more cases, clean up logs in code

* One more case

* Refactoring based on PR comments

* Updating i18n

* Some changes based on PR review

* Remove a comment

* Bring back some translations that were somehow removed

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-19 16:01:07 -04:00
Alejandro García Montoro
70e649b36a MM-27178: Use FileSettings.Directory in export tool (#15100)
* MM-27178: use FileSettings.Directory in export

* Set empty FileSettings.Directory to default value

* Validate that FileSettings.Directory is non-empty

* Don't set FileSettings.Directory to / in fixConfig

* Run make i18n-extract

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-04 13:58:48 +02:00
Doug Lauder
90ff87a77f MM-25731 Advanced Logging (#14888)
Adds Advanced Logging to server. Advanced Logging is an optional logging capability that allows customers to send log records to any number of destinations.

Supported destinations:
- file
- syslog (with out without TLS)
- raw TCP socket (with out without TLS)

Allows developers to specify discrete log levels as well as the standard trace, debug, info, ... panic. Existing code and logging API usage is unchanged.

Log records are emitted asynchronously to reduce latency to the caller. Supports hot-reloading of logger config, including adding removing targets.

Advanced Logging is configured within config.json via "LogSettings.AdvancedLoggingConfig" which can contain a filespec to another config file, a database DSN, or JSON.
2020-07-15 14:40:36 -04:00
Sudheer
50fd95717e MM-26620 Add a config setting for controlling ask community link (#14985)
* MM-26620 Add a config setting for controlling ask community link

* Update setting

* Change to support setting
2020-07-09 17:59:22 +05:30
Maria A Nunez
085ab2c60a MM-25762 - Moved password settings to client limited configuration (#14777)
* Moved password settings to limited configuration

* Added unit test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-18 06:14:03 -04:00
Sudheer
1b95b82b18 MM-25723 Add an experimental setting for data prefetching (#14731)
* MM-25723 Add an experimental setting for data prefetching

* Fix formatting

* Fix bool error

* Fix lint error

* Change default to true
2020-06-03 14:43:59 +05:30
shred86
c35a18d15c Add ShowFullName property (#14189) 2020-05-27 18:23:51 +02:00
Jesús Espino
ae328153d5 Fixing behavior of Replicas and SearchReplicas in canary environments (#14576)
* Fixing behavior of Replicas and SearchReplicas in canary environments

* Trying to fix tests

* Revert "Trying to fix tests"

This reverts commit 3531da9618.

* Revert "Fixing behavior of Replicas and SearchReplicas in canary environments"

This reverts commit 0c05901c84.

* Revert "Disable read/search db replicas in TE/E0 (#14400)"

This reverts commit ef5ac519d9.

* Making the store aware of the license

* Readding the unit tests

* Fixing sqlstor supplier tests

* Adding mutex to ensure license write consistency and fixing tests

* Fixing tests

* Fixing tests

* Shuting down server properly during tests

* Trying to fix tests

* Trying to fix the tests

* Skipping flaky tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 15:42:48 +02:00
Jesse Hallam
ee8bd4ece4 MM-23250: improve config.Migrate tests (#14479)
* MM-23250: improve config.Migrate tests

The config.Migrate tests were not running in isolation, but wrote over the "local" config. The test coverage for both directions was not exhaustive, and lacked coverage for the recently added plugin signature files.

Rewrite the unit tests as such, fixing a minor issue closing the stores after migration.

Fixes: https://mattermost.atlassian.net/browse/MM-23250

* idiomatic err checking

* clarify random file contents

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-19 21:03:02 -03:00
Scott Bishel
e6bbb4bd7a MM-24082: Add PictureAttribute to LDAP Settings in config (#14506)
* add new config setting for profile picture attribute

* update attribute names

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-14 13:25:23 -06:00
Doug Lauder
e27b86cae0 expose ServiceSettings.ExtendSessionLengthWithActivity config to clients (#14516) 2020-05-13 12:31:43 -04:00
Jesús Espino
ef5ac519d9 Disable read/search db replicas in TE/E0 (#14400)
* Disable read/search db replicas in TE/E0

* fixing tests

* Removing unnecesary text.

* Updating without-license read-replicas config before store initialization

* Reconnecting to database after remove read replicas
2020-05-07 14:11:05 +02:00
Agniva De Sarker
03a55367d9 MM-24312: Fix Dependency updates (#14391)
Automatic Merge
2020-04-29 14:06:09 -07:00
Jesse Hallam
29fae242e1 Revert "Dependency updates. (#14033)" (#14304)
This reverts commit f14c79f170.
2020-04-17 14:26:29 -03:00
George Goldberg
f14c79f170 Dependency updates. (#14033)
* Update dependencies.

* Fix tests.
2020-04-08 10:51:04 +01:00
Agniva De Sarker
125ed3a4cf MM-23817: Use auto-vendoring (#14231)
With Go 1.14 (https://tip.golang.org/doc/go1.14#go-command),
it now automatically checks for the existence of a vendor directory.

So there is no need to explicitly set the `-mod=vendor` flag.
2020-04-07 09:01:06 +05:30
Devin Binnie
1cde88f147 Setting to enable new experimental channel sidebar (#14036)
* Merge upstream

* [MM-20881] Server changes for new experimental channel sidebar setting (#13434)

* Remove report.xml

Co-authored-by: Jason Deland <jaydeland@gmail.com>
Co-authored-by: Devin Binnie <devin@Devins-MacBook-Pro.local>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-17 12:01:59 -04:00
upwell
058f235050 [GH-13931] Return error in parseDSN func #13931 (#13947)
Automatic Merge
2020-03-03 11:42:17 -05:00
Jesús Espino
7035e09fe9 Adding changes to separate unit tests and integration tests (#13670)
* Introducing unit (not integration) tests for the app layer

* Initial support for unit tests at the API

* Adding unit tests support to the store layer

* Add unit tests support in commands

* Adding last tests needed for run unit tests properly

* Fixing govet

* Removing some duplication

* Fixing tests

* Fixing tests

* Not compiling test helpers with the main module for api

* Revert "Not compiling test helpers with the main module for api"

This reverts commit 36a199bbe0.

* Fixing tests

* Fixing unit tests

* More consistency between api4/apiteslib.go and app/helper_test.go

* Renaming things to make more obvious the new Setup functions purpose

* Reverting change in go.sum

* Start with empty mock for app layer

* Start with empty mock for api layer

* Start with empty mock for web layer

* Renaming SetupWithStoreMockConfig to SetupConfigWithStoreMock

* Fixing tests on web package

* Removing unnecesary function
2020-03-02 08:13:39 -08:00
JtheBAB
cd36c9f041 MM-22355 - Fix typos detected by goreportcad.com (#13842)
* Update webhook_test.go

* Update user_test.go

* Update filesstore_test.go

* Update plugin_requests.go

* Update syncables.go

* Update helper.go

* Update html_entities.go

* Update user.go

* Update team.go

* Update notification.go

* Update notification_test.go

* Update plugin_api_test.go

* Update post_metadata.go

* Update channel_test.go

* Update database.go

* Update channel.go

* Update user_store.go

* Update team_test.go

* revert andd

* Revert back to infintie

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-02 17:10:40 +01:00
Miguel de la Cruz
84f45634a8 Remove remaining t.Fatal from the codebase (#13876)
* Remove remaining t.Fatal from the codebase

* Fix job_store test

* Address review comments

* Remove comments
2020-02-13 17:53:23 +01:00
Jesús Espino
1d1ab03c38 Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions

* Fixing build
2020-02-10 19:31:41 +01:00
Jesús Espino
596f986755 Switch to Postgres when running tests and turn off the fsync setting (#13678)
* Run all tests fasts in postgres

* Moving postgres config to a file

* Addressing PR review comments

* Testing against mysql in the CI to keep things less changed

* Revert "Testing against mysql in the CI to keep things less changed"

This reverts commit fc940c111d.

* Fixing a test broken in postgres but working in mysql

* Fixing some tests

* Fixing some config tests with postgres

* Fixing the rest of config tests

* Fixing govet error

* Fixing search tests for postgres
2020-02-06 15:15:18 +01:00
Andy Librian
3865bc501e golint fix (#13613) 2020-01-20 12:32:20 +01:00
Patryk Pomykalski
5f7ca55b13 MM-21520: Remove temporary databases after tests run (#13572)
* MM-21520: Remove temorary databases after tests run

* accidental test name change

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-13 16:54:07 +01:00
Agniva De Sarker
ecb41c6eb5 MM-21285: Remove environment overrides before config broadcast (#13527)
While sending the config broadcast message across a cluster, we would
include the environment overrides in the config.

We fix this by exposing a config config store method to remove the overrides,
and then calling that before saving the config across the cluster.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-07 23:21:28 +05:30