summaryrefslogtreecommitdiffstats
path: root/app/app.go
Commit message (Collapse)AuthorAgeFilesLines
* MM-10424: Migrate PostEditTimeLimit config setting. (#8702)George Goldberg2018-05-021-0/+8
|
* Structured logging (#8673)Christopher Speller2018-04-271-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implementing structured logging * Changes to en.json to allow refactor to run. * Fixing global logger * Structured logger initalization. * Add caller. * Do some log redirection. * Auto refactor * Cleaning up l4g reference and removing dependancy. * Removing junk. * Copyright headers. * Fixing tests * Revert "Changes to en.json to allow refactor to run." This reverts commit fd8249e99bcad0231e6ea65cd77c32aae9a54026. * Fixing some auto refactor strangeness and typo. * Making keys more human readable.
* Merge remote-tracking branch 'origin/release-4.9' into merge49finalDerrick Anderson2018-04-171-0/+7
|\
| * Prevent disabling or modifying l4g logging filters (#8628)Jesse Hallam2018-04-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The underlying l4g library is not resilient to filter modifications in the presence of concurrent goroutines. In particular, it's not safe to call Close() on filters which might be actively held by a goroutine for logging. This change disables all modifications to existing filters once initialized by the App layer. In practice, we might be able to get away with some modifications to the existing filters (i.e. changing levels), but the [golang memory model](https://golang.org/ref/mem) makes no guarantees that it is safe to do so: > Programs that modify data being simultaneously accessed by multiple goroutines must serialize such access. We can solve this holistically by introducing the requisite locking within our fork of the l4g library. For now, we just disable all modifications.
* | MM-9849 Added tracking of which settings are set through environment ↵Harrison Healey2018-04-091-0/+1
|/ | | | | | | | | | | | | | | | variables (#8586) * MM-9849 Added tracking of which settings are set through environment variables * Removed old version of viper * Added forked version of viper * Fixed unit tests * Fixed more unit tests * Removed copy from App.GetEnvironmentConfig
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1Martin Kraft2018-03-271-1/+1
|\
| * Relax 4k post message limit (#8478)Jesse Hallam2018-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * MM-9661: rename POST_MESSAGE_MAX_RUNES to \0_v1 * MM-9661: s/4000/POST_MESSAGE_MAX_RUNES_V1/ in tests * MM-9661: introduce POST_MESSAGE_MAX_RUNES_V2 * MM-9661: migrate Postgres Posts.Message column to TEXT from VARCHAR(4000) This is safe to do in a production instance since the underyling type is not changing. We explicitly don't do this automatically for MySQL, but also don't need to since the ORM would have already created a TEXT column for MySQL in that case. * MM-9661: emit MaxPostSize in client config This value remains unconfigurable at this time, but exposes the current limit to the client. The limit remains at 4k in this commit. * MM-9661: introduce and use SqlPostStore.GetMaxPostSize Enforce a byte limitation in the database, and use 1/4 of that value as the rune count limitation (assuming a worst case UTF-8 representation). * move maxPostSizeCached, lastPostsCache and lastPostTimeCache out of the global context and onto the SqlPostStore * address feedback from code review: * ensure sqlstore unit tests are actually being run * move global caches into SqlPostStore * leverage sync.Once to address a race condition * modify upgrade semantics to match new db semantics gorp's behaviour on creating columns with a maximum length on Postgres differs from MySQL: * Postgres * gorp uses TEXT for string columns without a maximum length * gorp uses VARCHAR(N) for string columns with a maximum length of N * MySQL * gorp uses TEXT for string columns with a maximum length >= 256 * gorp uses VARCHAR(N) for string columns with a maximum length of N * gorp defaults to a maximum length of 255, implying VARCHAR(255) So the Message column has been TEXT on MySQL but VARCHAR(4000) on Postgres. With the new, longer limits of 65535, and without changes to gorp, the expected behaviour is TEXT on MySQL and VARCHAR(65535) on Postgres. This commit makes the upgrade semantics match the new database semantics. Ideally, we'd revisit the gorp behaviour at a later time. * allow TestMaxPostSize test cases to actually run in parallel * default maxPostSizeCached to POST_MESSAGE_MAX_RUNES_V1 in case the once initializer panics * fix casting error * MM-9661: skip the schema migration for Postgres It turns out resizing VARCHAR requires a rewrite in some versions of Postgres, but migrating VARCHAR to TEXT does not. Given the increasing complexity, let's defer the migration to the enduser instead.
* | Merge branch 'master' into advanced-permissions-phase-1Martin Kraft2018-03-231-1/+10
|\|
| * Timezone feature (#8185)Chris Duarte2018-03-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add supported timezones into config Remove Timezone list creation in favor of timezone from configs Add Timezone field to Users table Clean up format of SupportedTimezones in config * Remove unwanted change * Add test for updating user timezone * Add empty map[string]string if Timezone is null * Add EnableTimezoneSelection config * Revert back to map[string]string for ClientConfig * Refactor SupportedTimezones into timezones.json * Include timezones.json in TestConfigFlag * Add timezone api endpoint * Bump varchar size to 256 and setMaxSize in user_store * Refactor LoadConfig to LoadConfig and LoadTimezoneConfig * Remove unnecessary argument in LoadConfig, mail_test * Add test for timezone endpoint * Add license header * Refactor timezones endpoint to system.go * Add system base route to timezone endpoint * db timezone upgrade in db v4.9 * Avoid saving SupportedTimezones to config.json * Add timezonePath support in config * Remove EnableTimezoneSelection from config * Use return statement without return parameter * Refactor test for SupportedTimezones * Check for supportedTimezone != nil instead of using len * Decouple SupportedTimezones out of Config * Fix failing test * Add LastTeamIconUpdate back in upgrade.go * Write timezone config in config_flag_test * Add code fallback for default timezone support
| * Fix various segfaults when running `go test` manually (#8448)Jesse Hallam2018-03-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * failing to find i18n shouldn't segfault The server was trying to handle the fact that it couldn't find the i18n directory, by emitting a translated log message... * fix utils.FindDir The attempts to find the directory in the parent or grandparent directory don't work if the current working directory was inside `enterprise`, with `enterprise` itself being a symlink as per the usual developer setup. Recurse to the root of the filesystem, cleaning the path along the way to work around this limitation (and allow tests to be run from an arbitrarily deep nesting level.) Fix corresponding usages to employ filepath.Join. * failing to find html templates shouldn't segfault * fail fast if the test user cannot be created * rework utils.FindDir to retain backwards compatibility
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-131-1/+17
|\|
| * MM-8604: emit config/license websocket events (#8371)Jesse Hallam2018-03-051-1/+17
| |
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-021-0/+2
|\|
| * Remove global site url (#8343)Chris2018-02-221-0/+2
| | | | | | | | | | | | | | | | * remove global site url * missed one * revert mysterious change
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-131-17/+35
|\|
| * Add tests for the `platform server` command (#8231)Pierre de La Morinerie2018-02-121-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Cleanup app state on initialization error When returning an initialization error, the app state was not cleaned up. This is especially visible during tests, as `appCount` is not decremented, and makes the new app initialization fail. * Test the `platform server` command As the `platform server` command only exits when interrupted by a signal, it is not possible to test it as the other cobra commands. Instead we directly test the actual command function. The internal command handler is slighly refactored to take a channel in argument, and registers it as the signal handler. Nothing very different—except than controlling this channel from the outside allows the test to send the system signal itself, thus preventing the server to run forever.
| * Remove license globals entirely (#8229)Chris2018-02-091-11/+13
| | | | | | | | | | | | | | | | * remove license globals entirely * fix infinite recursion * test fix
| * Eliminate utils.SetLicense calls (#8217)Chris2018-02-071-0/+3
| | | | | | | | | | | | | | | | | | | | * eliminate utils.SetLicense calls * test fix * another test fix * more test fixes
| * ABC-132: sign error page parameters (#8197)Chris2018-02-071-8/+14
| | | | | | | | | | | | * sign error page parameters * add comments
* | XYZ-51: Unit tests for and changes to SetRolePermissionsFromConfig. (#8160)Martin Kraft2018-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * XYZ-10: Role store. * XYZ-37: Update unit tests to work with database roles. * XYZ-51: Tests 'SetRolePermissionsFromConfig' against JSON from policy page. * XYZ-51: Adds permissions in non-licensed cases also. * XYZ-51: Removes some permissions from team_user role. * XYZ-51: Merge fix for change to default permissions from PR 8208. * XYZ-51: Removes unused function.
* | XYZ-37: Advanced Permissions Phase 1 Backend. (#8159)George Goldberg2018-02-061-3/+57
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * XYZ-13: Update Permission and Role structs to new design. * XYZ-10: Role store. * XYZ-9/XYZ-44: Roles API endpoints and WebSocket message. * XYZ-8: Switch server permissions checks to store backed roles. * XYZ-58: Proper validation of roles where required. * XYZ-11/XYZ-55: Migration to store backed roles from policy config. * XYZ-37: Update unit tests to work with database roles. * XYZ-56: Remove the "guest" role. * Changes to SetDefaultRolesFromConfig. * Short-circuit the store if nothing has changed. * Address first round of review comments. * Address second round of review comments.
* Remove global cfg vars (#8099)Chris2018-01-121-12/+18
| | | | | | * remove global cfg vars * enterprise update
* Remove global config watcher (#8080)Chris2018-01-111-48/+14
| | | | | | | | | | * remove global config watcher * keep config watcher disabled for tests * compile fix * fix resource leak
* [PLT-6936] Translate AppError.Message automatically by default (#8063)Jesús Espino2018-01-081-1/+1
|
* Remove utils.ClientCfg and utils.ClientCfgHash (#8041)Chris2018-01-051-2/+59
| | | | | | * remove utils.ClientCfg and utils.ClientCfgHash * remove unused import
* Add plugin slash command support (#7941)Chris2017-12-081-0/+4
| | | | | | | | * add plugin slash command support * remove unused string * rebase
* PLT-7503: Create Message Export Scheduled Task and CLI Command (#7612)Jonathan2017-11-301-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Created message export scheduled task * Added CLI command to immediately kick off an export job * Added email addresses for users joining and leaving the channel to the export * Added support for both MySQL and PostgreSQL * Fixing gofmt error * Added a new ChannelMemberHistory store and associated tests * Updating the ChannelMemberHistory channel as users create/join/leave channels * Added user email to the message export object so it can be included in the actiance export xml * Don't fail to log a leave event if a corresponding join event wasn't logged * Adding copyright notices * Adding message export settings to daily diagnostics report * Added System Console integration for message export * Cleaned up TODOs * Made batch size configurable * Added export from timestamp to CLI command * Made ChannelMemberHistory table updates best effort * Added a context-based timeout option to the message export CLI * Minor PR updates/improvements * Removed unnecessary fields from MessageExport object to reduce query overhead * Removed JSON functions from the message export query in an effort to optimize performance * Changed the way that channel member history queries and purges work to better account for edge cases * Fixing a test I missed with the last refactor * Added file copy functionality to file backend, improved config validation, added default config values * Fixed file copy tests * More concise use of the testing libraries * Fixed context leak error * Changed default export path to correctly place an 'export' directory under the 'data' directory * Can't delete records from a read replica * Fixed copy file tests * Start job workers when license is applied, if configured to do so * Suggestions from the PR * Moar unit tests * Fixed test imports
* HTTP client refactor (#7884)Chris2017-11-221-0/+39
| | | | | | * http client refactor * simplification
* Role refactor (#7867)Chris2017-11-211-0/+8
| | | | | | | | * role refactor * add missing file * fix web test
* refactor template code (#7860)Chris2017-11-201-1/+17
|
* Reorganize file util functionality (#7848)Chris2017-11-161-2/+28
| | | | | | | | * reorganize file util functionality * fix api test compilation * fix rebase issue
* fix config cli option (#7850)Chris2017-11-161-10/+13
|
* fix builtin plugin http router (#7797)Chris2017-11-061-0/+1
|
* invoke config listeners when app.UpdateConfig is used (#7773)Chris2017-11-031-0/+2
|
* PLT-8086 Fix plugin config watcher for enabling and disabling (#7770)Joram Wilander2017-11-031-0/+3
| | | | | | | | * Fix plugin config watcher for enabling and disabling * Make sure HTTP routes are served * Set content-type explicitly
* Refactoring cfg refs and load / save functions (#7749)Chris2017-10-311-0/+19
| | | | | | * refactoring cfg refs and load / save functions * improve error output
* Remove more global refs / state (#7723)Chris2017-10-261-2/+12
| | | | | | | | | | * remove more global refs / state * fix job enterprise initialization * fix api4 test compilation * saml api endpoints fix
* Reduce utils.Cfg references (#7650)Chris2017-10-181-5/+5
| | | | | | | | | | | | * app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
* parallel tests (#7629)Chris2017-10-161-2/+6
|
* Miscellaneous app cleanup (#7594)Chris2017-10-091-18/+47
| | | | | | | | | | | | * app cleanup * whoops, forgot a file * some minor cleanup * longer container deadline * defensive checks
* Fix races / finally remove global app for good (#7570)Chris2017-10-041-36/+20
| | | | | | | | | | | | * finally remove global app for good * test compilation fixes * fix races * fix deadlock * wake up write pump so it doesn't take forever to clean up
* Goroutine wranglin (#7556)Chris2017-10-031-8/+45
| | | | | | * goroutine wranglin * synchronize WebConn.WritePump
* PLT-7705: API to get data retention policy. (#7539)George Goldberg2017-10-021-6/+15
| | | | | | * PLT-7705: API to get data retention policy. * Fix review comments.
* Don't use global app for api / api4 tests (#7528)Chris2017-10-021-1/+33
| | | | | | | | | | | | | | * don't use global app for api / api4 tests * put sleep back. we're gonna have to do some goroutine wrangling * fix oauth test config assumptions * jobs package, i'm comin' for you next * app test fix * try increasing sleep a little
* remove jobs.Srv and other jobs-related globals (#7535)Chris2017-09-291-1/+44
|
* remove remaining Global() calls (outside of tests) (#7521)Chris2017-09-281-0/+5
|
* PLT-7542 Converting LDAP sync to the job server (#7452)Corey Hulen2017-09-251-2/+0
| | | | | | | | | | | | | | | | | | | | * PLT-7542 Converting LDAP sync to the job server * Fixing minor issues * Fixing build failure * Translate error message * Translate error message * Translate error message * Translate error message * Fixing merge * Fixing bad merge
* remove more global refs (#7480)Chris2017-09-211-9/+85
|
* remove einterface gets (#7455)Chris2017-09-191-1/+27
|
* fix plugin test (#7436)Chris2017-09-121-2/+3
| | | | | | | | | | | | * fix plugin test * ugh. global state * Fix plugin test * Fix TestDeleteChannel * Remove plugin config listener when shutting down