passenger 5.2.3 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -0
- data/CONTRIBUTORS +5 -1
- data/build/agent.rb +22 -2
- data/build/cxx_tests.rb +41 -5
- data/build/misc.rb +4 -1
- data/build/support/cxx_dependency_map.rb +1746 -908
- data/build/support/vendor/cxx_hinted_parser/CxxHintedParser.sublime-project +8 -0
- data/build/support/vendor/cxx_hinted_parser/Gemfile +5 -0
- data/build/support/vendor/cxx_hinted_parser/Gemfile.lock +30 -0
- data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core → build/support/vendor/cxx_hinted_parser}/LICENSE.md +1 -1
- data/build/support/vendor/cxx_hinted_parser/README.md +95 -0
- data/build/support/vendor/cxx_hinted_parser/Rakefile +4 -0
- data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/initialize.rb → build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb} +2 -9
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +239 -0
- data/dev/ci/README.md +15 -2
- data/dev/ci/lib/set-container-envvars.sh +6 -0
- data/dev/ci/lib/setup-container.sh +4 -1
- data/dev/ci/scripts/debug-console-wrapper.sh +3 -1
- data/dev/ci/setup-host +5 -0
- data/dev/ci/tests/binaries/Jenkinsfile +105 -0
- data/dev/ci/tests/binaries/build-linux +38 -0
- data/dev/ci/tests/binaries/build-macos +40 -0
- data/dev/ci/tests/binaries/prepare-macos +38 -0
- data/dev/ci/tests/binaries/test-linux +45 -0
- data/dev/ci/tests/binaries/test-macos +38 -0
- data/dev/ci/tests/debian/Jenkinsfile +2 -2
- data/dev/ci/tests/rpm/Jenkinsfile +1 -1
- data/dev/configkit-schemas/index.json +3 -24
- data/dev/vagrant/nginx_rakefile +0 -1
- data/package.json +15 -5
- data/resources/templates/error_renderer/.editorconfig +19 -0
- data/resources/templates/error_renderer/with_details/README.md +9 -0
- data/resources/templates/error_renderer/with_details/dist/bundle.js +33 -0
- data/resources/templates/error_renderer/with_details/dist/styles.css +17 -0
- data/resources/templates/error_renderer/with_details/src/DetailsView.jsx +52 -0
- data/resources/templates/error_renderer/with_details/src/GetHelpView.jsx +61 -0
- data/resources/templates/error_renderer/with_details/src/JourneyView.css +50 -0
- data/resources/templates/error_renderer/with_details/src/JourneyView.jsx +621 -0
- data/resources/templates/error_renderer/with_details/src/PageMain.css +114 -0
- data/resources/templates/error_renderer/with_details/src/PageMain.jsx +136 -0
- data/resources/templates/error_renderer/with_details/src/ProblemDescriptionView.jsx +14 -0
- data/resources/templates/error_renderer/with_details/src/ProcessDetailsView.jsx +56 -0
- data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.css +5 -0
- data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.jsx +15 -0
- data/resources/templates/error_renderer/with_details/src/SummaryView.jsx +35 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentView.css +34 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentView.jsx +168 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentsView.css +13 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentsView.jsx +116 -0
- data/resources/templates/error_renderer/with_details/src/Tab.jsx +12 -0
- data/resources/templates/error_renderer/with_details/src/Tabs.jsx +104 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.css +3446 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.js +293 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/config.json +401 -0
- data/resources/templates/error_renderer/with_details/src/index.html.template +22 -0
- data/resources/templates/error_renderer/with_details/src/index.jsx +23 -0
- data/resources/templates/error_renderer/with_details/webpack.config.js +47 -0
- data/resources/templates/error_renderer/without_details/dist/bundle.js +1 -0
- data/resources/templates/error_renderer/without_details/dist/styles.css +1 -0
- data/resources/templates/{undisclosed_error.html.template → error_renderer/without_details/src/index.html.template} +7 -11
- data/resources/templates/error_renderer/without_details/src/index.js +1 -0
- data/resources/templates/{error_layout.css → error_renderer/without_details/src/main.css} +5 -2
- data/resources/templates/error_renderer/without_details/webpack.config.js +42 -0
- data/src/agent/AgentMain.cpp +3 -3
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +13 -0
- data/src/agent/Core/ApplicationPool/Common.h +3 -4
- data/src/agent/Core/ApplicationPool/Context.h +27 -17
- data/src/agent/Core/ApplicationPool/Group.h +3 -1
- data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +2 -12
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +55 -10
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +13 -6
- data/src/agent/Core/ApplicationPool/Implementation.cpp +16 -100
- data/src/agent/Core/ApplicationPool/Options.h +8 -65
- data/src/agent/Core/ApplicationPool/Pool.h +4 -21
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -60
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +10 -13
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +3 -8
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +2 -34
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Process.cpp +17 -12
- data/src/agent/Core/ApplicationPool/Process.h +146 -93
- data/src/agent/Core/ApplicationPool/Session.h +2 -2
- data/src/agent/Core/ApplicationPool/Socket.h +28 -27
- data/src/agent/Core/Config.h +1 -3
- data/src/agent/Core/ConfigChange.cpp +2 -4
- data/src/agent/Core/Controller.h +2 -8
- data/src/agent/Core/Controller/BufferBody.cpp +0 -2
- data/src/agent/Core/Controller/CheckoutSession.cpp +12 -24
- data/src/agent/Core/Controller/Config.h +1 -9
- data/src/agent/Core/Controller/ForwardResponse.cpp +0 -34
- data/src/agent/Core/Controller/Hooks.cpp +0 -7
- data/src/agent/Core/Controller/InitRequest.cpp +0 -43
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +0 -4
- data/src/agent/Core/Controller/Request.h +1 -35
- data/src/agent/Core/Controller/SendRequest.cpp +0 -32
- data/src/agent/Core/CoreMain.cpp +19 -32
- data/src/agent/Core/SpawningKit/Config.h +329 -55
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +369 -0
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +307 -0
- data/src/agent/Core/SpawningKit/Context.h +211 -0
- data/src/agent/Core/SpawningKit/DirectSpawner.h +112 -122
- data/src/agent/Core/SpawningKit/DummySpawner.h +59 -20
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +117 -0
- data/src/agent/Core/SpawningKit/Exceptions.h +1157 -0
- data/src/agent/Core/SpawningKit/Factory.h +24 -17
- data/src/agent/Core/SpawningKit/{BackgroundIOCapturer.h → Handshake/BackgroundIOCapturer.h} +48 -18
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +1650 -0
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +582 -0
- data/src/agent/Core/SpawningKit/Handshake/Session.h +91 -0
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +100 -0
- data/src/agent/Core/SpawningKit/Journey.h +561 -0
- data/src/agent/Core/SpawningKit/PipeWatcher.h +41 -18
- data/src/agent/Core/SpawningKit/README.md +534 -0
- data/src/agent/Core/SpawningKit/Result.h +182 -7
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +69 -0
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +110 -0
- data/src/agent/Core/SpawningKit/SmartSpawner.h +1027 -562
- data/src/agent/Core/SpawningKit/Spawner.h +70 -1134
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +3 -33
- data/src/agent/README.md +2 -3
- data/src/agent/Shared/ApiServerUtils.h +2 -3
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +932 -0
- data/src/agent/Watchdog/Config.h +1 -3
- data/src/agent/Watchdog/WatchdogMain.cpp +2 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +22 -13
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +13 -0
- data/src/cxx_supportlib/Constants.h +3 -1
- data/src/cxx_supportlib/Exceptions.h +0 -121
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +7 -6
- data/src/cxx_supportlib/LoggingKit/Logging.h +3 -1
- data/src/cxx_supportlib/Utils.cpp +42 -0
- data/src/cxx_supportlib/Utils.h +7 -0
- data/src/cxx_supportlib/Utils/IOUtils.cpp +58 -0
- data/src/cxx_supportlib/Utils/IOUtils.h +13 -0
- data/src/cxx_supportlib/Utils/JsonUtils.h +130 -23
- data/src/cxx_supportlib/Utils/ScopeGuard.h +9 -4
- data/src/cxx_supportlib/Utils/StrIntUtils.cpp +7 -0
- data/src/cxx_supportlib/Utils/StrIntUtils.h +1 -0
- data/src/cxx_supportlib/Utils/SystemTime.h +1 -1
- data/src/cxx_supportlib/Utils/Timer.h +1 -1
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +6 -4
- data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -0
- data/src/helper-scripts/node-loader.js +54 -59
- data/src/helper-scripts/rack-loader.rb +63 -60
- data/src/helper-scripts/rack-preloader.rb +125 -72
- data/src/helper-scripts/wsgi-loader.py +100 -43
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +120 -112
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +15 -8
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +142 -142
- data/src/nginx_module/ConfigGeneral/ManifestGeneration.c +26 -15
- data/src/nginx_module/ConfigGeneral/ManifestGeneration.h +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +76 -70
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +114 -99
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +170 -156
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +38 -35
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +5 -1
- data/src/ruby_supportlib/phusion_passenger.rb +5 -5
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +14 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +0 -3
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +646 -238
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +117 -95
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +5 -1
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +92 -69
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +0 -17
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +0 -3
- data/src/ruby_supportlib/phusion_passenger/request_handler.rb +4 -5
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +0 -22
- metadata +64 -67
- data/resources/templates/error_layout.html.template +0 -86
- data/resources/templates/general_error.html.template +0 -1
- data/resources/templates/general_error_with_html.html.template +0 -1
- data/src/agent/Core/ApplicationPool/ErrorRenderer.h +0 -131
- data/src/agent/Core/SpawningKit/Options.h +0 -41
- data/src/agent/Core/UnionStation/Connection.h +0 -173
- data/src/agent/Core/UnionStation/Context.h +0 -536
- data/src/agent/Core/UnionStation/StopwatchLog.h +0 -147
- data/src/agent/Core/UnionStation/Transaction.h +0 -249
- data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +0 -208
- data/src/cxx_supportlib/UnionStationFilterSupport.cpp +0 -67
- data/src/cxx_supportlib/UnionStationFilterSupport.h +0 -1622
- data/src/nodejs_supportlib/phusion_passenger/log_express.js +0 -106
- data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +0 -202
- data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +0 -227
- data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +0 -448
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/CONFIG.md +0 -37
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile +0 -17
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile.lock +0 -59
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README-API.md +0 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +0 -117
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +0 -115
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +0 -423
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +0 -238
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/connection.rb +0 -67
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +0 -281
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/lock.rb +0 -62
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/log.rb +0 -66
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/message_channel.rb +0 -157
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +0 -150
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +0 -199
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/controllers.rb +0 -187
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/misc.rb +0 -303
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/view_rendering.rb +0 -91
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +0 -396
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +0 -279
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +0 -39
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +0 -173
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +0 -177
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb +0 -32
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +0 -44
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +0 -16
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +0 -20
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +0 -18
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/union_station_hooks_core.gemspec +0 -23
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +0 -14
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +0 -45
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/LICENSE.md +0 -19
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +0 -104
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Rakefile +0 -160
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +0 -200
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_controller_extension.rb +0 -45
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_view_subscriber.rb +0 -55
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_record_subscriber.rb +0 -41
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb +0 -47
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +0 -79
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/exception_logger.rb +0 -57
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb +0 -32
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +0 -44
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +0 -34
@@ -0,0 +1,369 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2017 Phusion Holding B.V.
|
4
|
+
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
/*
|
28
|
+
* SpawningKit/Config/AutoGeneratedCode.h is automatically generated from
|
29
|
+
* SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder by the build system.
|
30
|
+
* It uses the comment hints from SpawningKit/Config.h.
|
31
|
+
*
|
32
|
+
* To force regenerating this file:
|
33
|
+
* rm -f src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h
|
34
|
+
* rake src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h
|
35
|
+
*/
|
36
|
+
|
37
|
+
inline void
|
38
|
+
Passenger::SpawningKit::Config::internStrings() {
|
39
|
+
size_t totalSize = 0;
|
40
|
+
size_t tmpSize;
|
41
|
+
char *newStorage, *pos, *end;
|
42
|
+
|
43
|
+
/*
|
44
|
+
* Calculated required storage size
|
45
|
+
*/
|
46
|
+
totalSize += appGroupName.size() + 1;
|
47
|
+
totalSize += appRoot.size() + 1;
|
48
|
+
totalSize += startCommand.size() + 1;
|
49
|
+
totalSize += startupFile.size() + 1;
|
50
|
+
totalSize += processTitle.size() + 1;
|
51
|
+
totalSize += appType.size() + 1;
|
52
|
+
totalSize += appEnv.size() + 1;
|
53
|
+
totalSize += spawnMethod.size() + 1;
|
54
|
+
totalSize += baseURI.size() + 1;
|
55
|
+
totalSize += user.size() + 1;
|
56
|
+
totalSize += group.size() + 1;
|
57
|
+
{
|
58
|
+
StringKeyTable<StaticString>::ConstIterator it(environmentVariables);
|
59
|
+
while (*it != NULL) {
|
60
|
+
totalSize += it.getValue().size() + 1;
|
61
|
+
it.next();
|
62
|
+
}
|
63
|
+
}
|
64
|
+
totalSize += logFile.size() + 1;
|
65
|
+
totalSize += apiKey.size() + 1;
|
66
|
+
totalSize += groupUuid.size() + 1;
|
67
|
+
|
68
|
+
/*
|
69
|
+
* Allocate new storage
|
70
|
+
*/
|
71
|
+
newStorage = pos = new char[totalSize];
|
72
|
+
end = newStorage + totalSize;
|
73
|
+
|
74
|
+
/*
|
75
|
+
* Fill new storage
|
76
|
+
*/
|
77
|
+
pos = appendData(pos, end, appGroupName);
|
78
|
+
pos = appendData(pos, end, "\0", 1);
|
79
|
+
pos = appendData(pos, end, appRoot);
|
80
|
+
pos = appendData(pos, end, "\0", 1);
|
81
|
+
pos = appendData(pos, end, startCommand);
|
82
|
+
pos = appendData(pos, end, "\0", 1);
|
83
|
+
pos = appendData(pos, end, startupFile);
|
84
|
+
pos = appendData(pos, end, "\0", 1);
|
85
|
+
pos = appendData(pos, end, processTitle);
|
86
|
+
pos = appendData(pos, end, "\0", 1);
|
87
|
+
pos = appendData(pos, end, appType);
|
88
|
+
pos = appendData(pos, end, "\0", 1);
|
89
|
+
pos = appendData(pos, end, appEnv);
|
90
|
+
pos = appendData(pos, end, "\0", 1);
|
91
|
+
pos = appendData(pos, end, spawnMethod);
|
92
|
+
pos = appendData(pos, end, "\0", 1);
|
93
|
+
pos = appendData(pos, end, baseURI);
|
94
|
+
pos = appendData(pos, end, "\0", 1);
|
95
|
+
pos = appendData(pos, end, user);
|
96
|
+
pos = appendData(pos, end, "\0", 1);
|
97
|
+
pos = appendData(pos, end, group);
|
98
|
+
pos = appendData(pos, end, "\0", 1);
|
99
|
+
{
|
100
|
+
StringKeyTable<StaticString>::Iterator it(environmentVariables);
|
101
|
+
while (*it != NULL) {
|
102
|
+
pos = appendData(pos, end, it.getValue());
|
103
|
+
pos = appendData(pos, end, "\0", 1);
|
104
|
+
it.next();
|
105
|
+
}
|
106
|
+
}
|
107
|
+
pos = appendData(pos, end, logFile);
|
108
|
+
pos = appendData(pos, end, "\0", 1);
|
109
|
+
pos = appendData(pos, end, apiKey);
|
110
|
+
pos = appendData(pos, end, "\0", 1);
|
111
|
+
pos = appendData(pos, end, groupUuid);
|
112
|
+
pos = appendData(pos, end, "\0", 1);
|
113
|
+
|
114
|
+
/*
|
115
|
+
* Move over pointers to new storage
|
116
|
+
*/
|
117
|
+
pos = newStorage;
|
118
|
+
tmpSize = appGroupName.size();
|
119
|
+
appGroupName = StaticString(pos, tmpSize);
|
120
|
+
pos += tmpSize + 1;
|
121
|
+
|
122
|
+
tmpSize = appRoot.size();
|
123
|
+
appRoot = StaticString(pos, tmpSize);
|
124
|
+
pos += tmpSize + 1;
|
125
|
+
|
126
|
+
tmpSize = startCommand.size();
|
127
|
+
startCommand = StaticString(pos, tmpSize);
|
128
|
+
pos += tmpSize + 1;
|
129
|
+
|
130
|
+
tmpSize = startupFile.size();
|
131
|
+
startupFile = StaticString(pos, tmpSize);
|
132
|
+
pos += tmpSize + 1;
|
133
|
+
|
134
|
+
tmpSize = processTitle.size();
|
135
|
+
processTitle = StaticString(pos, tmpSize);
|
136
|
+
pos += tmpSize + 1;
|
137
|
+
|
138
|
+
tmpSize = appType.size();
|
139
|
+
appType = StaticString(pos, tmpSize);
|
140
|
+
pos += tmpSize + 1;
|
141
|
+
|
142
|
+
tmpSize = appEnv.size();
|
143
|
+
appEnv = StaticString(pos, tmpSize);
|
144
|
+
pos += tmpSize + 1;
|
145
|
+
|
146
|
+
tmpSize = spawnMethod.size();
|
147
|
+
spawnMethod = StaticString(pos, tmpSize);
|
148
|
+
pos += tmpSize + 1;
|
149
|
+
|
150
|
+
tmpSize = baseURI.size();
|
151
|
+
baseURI = StaticString(pos, tmpSize);
|
152
|
+
pos += tmpSize + 1;
|
153
|
+
|
154
|
+
tmpSize = user.size();
|
155
|
+
user = StaticString(pos, tmpSize);
|
156
|
+
pos += tmpSize + 1;
|
157
|
+
|
158
|
+
tmpSize = group.size();
|
159
|
+
group = StaticString(pos, tmpSize);
|
160
|
+
pos += tmpSize + 1;
|
161
|
+
|
162
|
+
{
|
163
|
+
StringKeyTable<StaticString>::Iterator it(environmentVariables);
|
164
|
+
while (*it != NULL) {
|
165
|
+
tmpSize = it.getValue().size();
|
166
|
+
it.getValue() = StaticString(pos, tmpSize);
|
167
|
+
pos += tmpSize + 1;
|
168
|
+
it.next();
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
tmpSize = logFile.size();
|
173
|
+
logFile = StaticString(pos, tmpSize);
|
174
|
+
pos += tmpSize + 1;
|
175
|
+
|
176
|
+
tmpSize = apiKey.size();
|
177
|
+
apiKey = StaticString(pos, tmpSize);
|
178
|
+
pos += tmpSize + 1;
|
179
|
+
|
180
|
+
tmpSize = groupUuid.size();
|
181
|
+
groupUuid = StaticString(pos, tmpSize);
|
182
|
+
pos += tmpSize + 1;
|
183
|
+
|
184
|
+
|
185
|
+
/*
|
186
|
+
* Commit current storage
|
187
|
+
*/
|
188
|
+
storage.reset(newStorage);
|
189
|
+
}
|
190
|
+
|
191
|
+
inline bool
|
192
|
+
Passenger::SpawningKit::Config::validate(vector<StaticString> &errors) const {
|
193
|
+
bool ok = true;
|
194
|
+
const Config &config = *this;
|
195
|
+
|
196
|
+
if (OXT_UNLIKELY(appGroupName.empty())) {
|
197
|
+
ok = false;
|
198
|
+
errors.push_back(P_STATIC_STRING("app_group_name may not be empty"));
|
199
|
+
}
|
200
|
+
if (OXT_UNLIKELY(appRoot.empty())) {
|
201
|
+
ok = false;
|
202
|
+
errors.push_back(P_STATIC_STRING("app_root may not be empty"));
|
203
|
+
}
|
204
|
+
if (OXT_UNLIKELY(startCommand.empty())) {
|
205
|
+
ok = false;
|
206
|
+
errors.push_back(P_STATIC_STRING("start_command may not be empty"));
|
207
|
+
}
|
208
|
+
if (!config.genericApp && config.startsUsingWrapper && OXT_UNLIKELY(startupFile.empty())) {
|
209
|
+
ok = false;
|
210
|
+
errors.push_back(P_STATIC_STRING("startup_file may not be empty"));
|
211
|
+
}
|
212
|
+
if (OXT_UNLIKELY(appType.empty())) {
|
213
|
+
ok = false;
|
214
|
+
errors.push_back(P_STATIC_STRING("app_type may not be empty"));
|
215
|
+
}
|
216
|
+
if (OXT_UNLIKELY(appEnv.empty())) {
|
217
|
+
ok = false;
|
218
|
+
errors.push_back(P_STATIC_STRING("app_env may not be empty"));
|
219
|
+
}
|
220
|
+
if (OXT_UNLIKELY(spawnMethod.empty())) {
|
221
|
+
ok = false;
|
222
|
+
errors.push_back(P_STATIC_STRING("spawn_method may not be empty"));
|
223
|
+
}
|
224
|
+
if (OXT_UNLIKELY(baseURI.empty())) {
|
225
|
+
ok = false;
|
226
|
+
errors.push_back(P_STATIC_STRING("base_uri may not be empty"));
|
227
|
+
}
|
228
|
+
if (OXT_UNLIKELY(user.empty())) {
|
229
|
+
ok = false;
|
230
|
+
errors.push_back(P_STATIC_STRING("user may not be empty"));
|
231
|
+
}
|
232
|
+
if (OXT_UNLIKELY(group.empty())) {
|
233
|
+
ok = false;
|
234
|
+
errors.push_back(P_STATIC_STRING("group may not be empty"));
|
235
|
+
}
|
236
|
+
if (OXT_UNLIKELY(!(config.startTimeoutMsec > 0))) {
|
237
|
+
ok = false;
|
238
|
+
errors.push_back(P_STATIC_STRING("start_timeout_msec does not satisfy requirement: "
|
239
|
+
"config.startTimeoutMsec > 0"));
|
240
|
+
}
|
241
|
+
|
242
|
+
/*
|
243
|
+
* Excluded:
|
244
|
+
*
|
245
|
+
* logLevel
|
246
|
+
* genericApp
|
247
|
+
* startsUsingWrapper
|
248
|
+
* wrapperSuppliedByThirdParty
|
249
|
+
* findFreePort
|
250
|
+
* loadShellEnvvars
|
251
|
+
* debugWorkDir
|
252
|
+
* processTitle
|
253
|
+
* environmentVariables
|
254
|
+
* logFile
|
255
|
+
* apiKey
|
256
|
+
* groupUuid
|
257
|
+
* lveMinUid
|
258
|
+
* fileDescriptorUlimit
|
259
|
+
*/
|
260
|
+
|
261
|
+
return ok;
|
262
|
+
}
|
263
|
+
|
264
|
+
inline Json::Value
|
265
|
+
Passenger::SpawningKit::Config::getConfidentialFieldsToPassToApp() const {
|
266
|
+
Json::Value doc;
|
267
|
+
const Config &config = *this;
|
268
|
+
|
269
|
+
doc["app_group_name"] = appGroupName.toString();
|
270
|
+
doc["app_root"] = appRoot.toString();
|
271
|
+
doc["log_level"] = logLevel;
|
272
|
+
doc["generic_app"] = genericApp;
|
273
|
+
if (!config.genericApp) {
|
274
|
+
doc["starts_using_wrapper"] = startsUsingWrapper;
|
275
|
+
}
|
276
|
+
if (!config.genericApp && config.startsUsingWrapper) {
|
277
|
+
doc["wrapper_supplied_by_third_party"] = wrapperSuppliedByThirdParty;
|
278
|
+
}
|
279
|
+
doc["load_shell_envvars"] = loadShellEnvvars;
|
280
|
+
doc["start_command"] = startCommand.toString();
|
281
|
+
if (!config.genericApp && config.startsUsingWrapper) {
|
282
|
+
doc["startup_file"] = startupFile.toString();
|
283
|
+
}
|
284
|
+
if (!config.processTitle.empty()) {
|
285
|
+
doc["process_title"] = processTitle.toString();
|
286
|
+
}
|
287
|
+
doc["app_type"] = appType.toString();
|
288
|
+
doc["app_env"] = appEnv.toString();
|
289
|
+
doc["spawn_method"] = spawnMethod.toString();
|
290
|
+
doc["base_uri"] = baseURI.toString();
|
291
|
+
doc["user"] = user.toString();
|
292
|
+
doc["group"] = group.toString();
|
293
|
+
doc["environment_variables"] = tableToJson(environmentVariables);
|
294
|
+
doc["log_file"] = logFile.toString();
|
295
|
+
if (!config.apiKey.empty()) {
|
296
|
+
doc["api_key"] = apiKey.toString();
|
297
|
+
}
|
298
|
+
if (!config.groupUuid.empty()) {
|
299
|
+
doc["group_uuid"] = groupUuid.toString();
|
300
|
+
}
|
301
|
+
if (config.fileDescriptorUlimit > 0) {
|
302
|
+
doc["file_descriptor_ulimit"] = fileDescriptorUlimit;
|
303
|
+
}
|
304
|
+
|
305
|
+
/*
|
306
|
+
* Excluded:
|
307
|
+
*
|
308
|
+
* findFreePort
|
309
|
+
* debugWorkDir
|
310
|
+
* lveMinUid
|
311
|
+
* startTimeoutMsec
|
312
|
+
*/
|
313
|
+
|
314
|
+
return doc;
|
315
|
+
}
|
316
|
+
|
317
|
+
inline Json::Value
|
318
|
+
Passenger::SpawningKit::Config::getNonConfidentialFieldsToPassToApp() const {
|
319
|
+
Json::Value doc;
|
320
|
+
const Config &config = *this;
|
321
|
+
|
322
|
+
doc["app_group_name"] = appGroupName.toString();
|
323
|
+
doc["app_root"] = appRoot.toString();
|
324
|
+
doc["log_level"] = logLevel;
|
325
|
+
doc["generic_app"] = genericApp;
|
326
|
+
if (!config.genericApp) {
|
327
|
+
doc["starts_using_wrapper"] = startsUsingWrapper;
|
328
|
+
}
|
329
|
+
if (!config.genericApp && config.startsUsingWrapper) {
|
330
|
+
doc["wrapper_supplied_by_third_party"] = wrapperSuppliedByThirdParty;
|
331
|
+
}
|
332
|
+
doc["load_shell_envvars"] = loadShellEnvvars;
|
333
|
+
doc["start_command"] = startCommand.toString();
|
334
|
+
if (!config.genericApp && config.startsUsingWrapper) {
|
335
|
+
doc["startup_file"] = startupFile.toString();
|
336
|
+
}
|
337
|
+
if (!config.processTitle.empty()) {
|
338
|
+
doc["process_title"] = processTitle.toString();
|
339
|
+
}
|
340
|
+
doc["app_type"] = appType.toString();
|
341
|
+
doc["app_env"] = appEnv.toString();
|
342
|
+
doc["spawn_method"] = spawnMethod.toString();
|
343
|
+
doc["base_uri"] = baseURI.toString();
|
344
|
+
doc["user"] = user.toString();
|
345
|
+
doc["group"] = group.toString();
|
346
|
+
doc["environment_variables"] = "<SECRET>";
|
347
|
+
doc["log_file"] = "<SECRET>";
|
348
|
+
if (!config.apiKey.empty()) {
|
349
|
+
doc["api_key"] = "<SECRET>";
|
350
|
+
}
|
351
|
+
if (!config.groupUuid.empty()) {
|
352
|
+
doc["group_uuid"] = "<SECRET>";
|
353
|
+
}
|
354
|
+
if (config.fileDescriptorUlimit > 0) {
|
355
|
+
doc["file_descriptor_ulimit"] = fileDescriptorUlimit;
|
356
|
+
}
|
357
|
+
|
358
|
+
/*
|
359
|
+
* Excluded:
|
360
|
+
*
|
361
|
+
* findFreePort
|
362
|
+
* debugWorkDir
|
363
|
+
* lveMinUid
|
364
|
+
* startTimeoutMsec
|
365
|
+
*/
|
366
|
+
|
367
|
+
return doc;
|
368
|
+
}
|
369
|
+
|
@@ -0,0 +1,307 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2017 Phusion Holding B.V.
|
3
|
+
#
|
4
|
+
# "Passenger", "Phusion Passenger" and "Union Station" are registered
|
5
|
+
# trademarks of Phusion Holding B.V.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
require 'build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser'
|
26
|
+
|
27
|
+
def main
|
28
|
+
fields = parse_config_class_fields
|
29
|
+
comment copyright_header_for(__FILE__), 1
|
30
|
+
separator
|
31
|
+
|
32
|
+
comment %q{
|
33
|
+
SpawningKit/Config/AutoGeneratedCode.h is automatically generated from
|
34
|
+
SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder by the build system.
|
35
|
+
It uses the comment hints from SpawningKit/Config.h.
|
36
|
+
|
37
|
+
To force regenerating this file:
|
38
|
+
rm -f src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h
|
39
|
+
rake src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h
|
40
|
+
}
|
41
|
+
|
42
|
+
separator
|
43
|
+
|
44
|
+
|
45
|
+
function 'inline void Passenger::SpawningKit::Config::internStrings()' do
|
46
|
+
add_code %Q{
|
47
|
+
size_t totalSize = 0;
|
48
|
+
size_t tmpSize;
|
49
|
+
char *newStorage, *pos, *end;
|
50
|
+
}
|
51
|
+
|
52
|
+
separator
|
53
|
+
comment 'Calculated required storage size'
|
54
|
+
fields.each do |field|
|
55
|
+
case field.type
|
56
|
+
when 'StaticString'
|
57
|
+
add_code %Q{
|
58
|
+
totalSize += #{field.name}.size() + 1;
|
59
|
+
}
|
60
|
+
when 'StringKeyTable<StaticString>'
|
61
|
+
add_code %Q{
|
62
|
+
{
|
63
|
+
StringKeyTable<StaticString>::ConstIterator it(#{field.name});
|
64
|
+
while (*it != NULL) {
|
65
|
+
totalSize += it.getValue().size() + 1;
|
66
|
+
it.next();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
separator
|
74
|
+
comment 'Allocate new storage'
|
75
|
+
add_code %Q{
|
76
|
+
newStorage = pos = new char[totalSize];
|
77
|
+
end = newStorage + totalSize;
|
78
|
+
}
|
79
|
+
|
80
|
+
separator
|
81
|
+
comment 'Fill new storage'
|
82
|
+
fields.each do |field|
|
83
|
+
case field.type
|
84
|
+
when 'StaticString'
|
85
|
+
add_code %Q{
|
86
|
+
pos = appendData(pos, end, #{field.name});
|
87
|
+
pos = appendData(pos, end, "\\0", 1);
|
88
|
+
}
|
89
|
+
when 'StringKeyTable<StaticString>'
|
90
|
+
add_code %Q{
|
91
|
+
{
|
92
|
+
StringKeyTable<StaticString>::Iterator it(#{field.name});
|
93
|
+
while (*it != NULL) {
|
94
|
+
pos = appendData(pos, end, it.getValue());
|
95
|
+
pos = appendData(pos, end, "\\0", 1);
|
96
|
+
it.next();
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
separator
|
104
|
+
comment 'Move over pointers to new storage'
|
105
|
+
add_code %Q{
|
106
|
+
pos = newStorage;
|
107
|
+
}
|
108
|
+
fields.each do |field|
|
109
|
+
case field.type
|
110
|
+
when 'StaticString'
|
111
|
+
add_code %Q{
|
112
|
+
tmpSize = #{field.name}.size();
|
113
|
+
#{field.name} = StaticString(pos, tmpSize);
|
114
|
+
pos += tmpSize + 1;
|
115
|
+
}
|
116
|
+
separator
|
117
|
+
when 'StringKeyTable<StaticString>'
|
118
|
+
add_code %Q{
|
119
|
+
{
|
120
|
+
StringKeyTable<StaticString>::Iterator it(#{field.name});
|
121
|
+
while (*it != NULL) {
|
122
|
+
tmpSize = it.getValue().size();
|
123
|
+
it.getValue() = StaticString(pos, tmpSize);
|
124
|
+
pos += tmpSize + 1;
|
125
|
+
it.next();
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
separator
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
separator
|
134
|
+
comment 'Commit current storage'
|
135
|
+
add_code %Q{
|
136
|
+
storage.reset(newStorage);
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
function 'inline bool Passenger::SpawningKit::Config::validate(vector<StaticString> &errors) const' do
|
142
|
+
add_code %q{
|
143
|
+
bool ok = true;
|
144
|
+
const Config &config = *this;
|
145
|
+
}
|
146
|
+
|
147
|
+
separator
|
148
|
+
excluded_field_names = []
|
149
|
+
|
150
|
+
fields.each do |field|
|
151
|
+
if field.metadata[:only_meaningful_if]
|
152
|
+
meaningfulness_check = "#{field.metadata[:only_meaningful_if]} && "
|
153
|
+
end
|
154
|
+
|
155
|
+
if field.metadata[:require_non_empty]
|
156
|
+
add_code %Q{
|
157
|
+
if (#{meaningfulness_check}OXT_UNLIKELY(#{field.name}.empty())) {
|
158
|
+
ok = false;
|
159
|
+
errors.push_back(P_STATIC_STRING("#{key_for(field)} may not be empty"));
|
160
|
+
}
|
161
|
+
}
|
162
|
+
elsif field.metadata[:require]
|
163
|
+
add_code %Q{
|
164
|
+
if (#{meaningfulness_check}OXT_UNLIKELY(!(#{field.metadata[:require]}))) {
|
165
|
+
ok = false;
|
166
|
+
errors.push_back(P_STATIC_STRING("#{key_for(field)} does not satisfy requirement: "
|
167
|
+
#{field.metadata[:require].inspect}));
|
168
|
+
}
|
169
|
+
}
|
170
|
+
else
|
171
|
+
excluded_field_names << field.name
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
separator
|
176
|
+
comment "Excluded:\n\n#{excluded_field_names.join("\n")}"
|
177
|
+
separator
|
178
|
+
add_code %Q{
|
179
|
+
return ok;
|
180
|
+
}
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
function 'inline Json::Value Passenger::SpawningKit::Config::getConfidentialFieldsToPassToApp() const' do
|
185
|
+
add_code %q{
|
186
|
+
Json::Value doc;
|
187
|
+
const Config &config = *this;
|
188
|
+
}
|
189
|
+
|
190
|
+
separator
|
191
|
+
|
192
|
+
excluded_field_names = []
|
193
|
+
fields.each do |field|
|
194
|
+
if field.metadata[:pass_during_handshake]
|
195
|
+
setter_code = %Q{
|
196
|
+
doc["#{key_for(field)}"] = #{value_expression_for(field)};
|
197
|
+
}
|
198
|
+
if field.metadata[:only_meaningful_if] || field.metadata[:only_pass_during_handshake_if]
|
199
|
+
conditions = [
|
200
|
+
field.metadata[:only_meaningful_if],
|
201
|
+
field.metadata[:only_pass_during_handshake_if]
|
202
|
+
].compact
|
203
|
+
add_code %Q[
|
204
|
+
if (#{conditions.join(" && ")}) {
|
205
|
+
]
|
206
|
+
indent do
|
207
|
+
add_code(setter_code)
|
208
|
+
end
|
209
|
+
add_code %Q[
|
210
|
+
}
|
211
|
+
]
|
212
|
+
else
|
213
|
+
add_code(setter_code)
|
214
|
+
end
|
215
|
+
else
|
216
|
+
excluded_field_names << field.name
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
separator
|
221
|
+
comment "Excluded:\n\n#{excluded_field_names.join("\n")}"
|
222
|
+
separator
|
223
|
+
add_code %q{
|
224
|
+
return doc;
|
225
|
+
}
|
226
|
+
end
|
227
|
+
|
228
|
+
function 'inline Json::Value Passenger::SpawningKit::Config::getNonConfidentialFieldsToPassToApp() const' do
|
229
|
+
add_code %q{
|
230
|
+
Json::Value doc;
|
231
|
+
const Config &config = *this;
|
232
|
+
}
|
233
|
+
|
234
|
+
separator
|
235
|
+
|
236
|
+
excluded_field_names = []
|
237
|
+
fields.each do |field|
|
238
|
+
if field.metadata[:pass_during_handshake]
|
239
|
+
if field.metadata[:non_confidential]
|
240
|
+
setter_code = %Q{
|
241
|
+
doc["#{key_for(field)}"] = #{value_expression_for(field)};
|
242
|
+
}
|
243
|
+
else
|
244
|
+
setter_code = %Q{
|
245
|
+
doc["#{key_for(field)}"] = "<SECRET>";
|
246
|
+
}
|
247
|
+
end
|
248
|
+
if field.metadata[:only_meaningful_if] || field.metadata[:only_pass_during_handshake_if]
|
249
|
+
conditions = [
|
250
|
+
field.metadata[:only_meaningful_if],
|
251
|
+
field.metadata[:only_pass_during_handshake_if]
|
252
|
+
].compact
|
253
|
+
add_code %Q[
|
254
|
+
if (#{conditions.join(" && ")}) {
|
255
|
+
]
|
256
|
+
indent do
|
257
|
+
add_code(setter_code)
|
258
|
+
end
|
259
|
+
add_code %Q[
|
260
|
+
}
|
261
|
+
]
|
262
|
+
else
|
263
|
+
add_code(setter_code)
|
264
|
+
end
|
265
|
+
else
|
266
|
+
excluded_field_names << field.name
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
separator
|
271
|
+
comment "Excluded:\n\n#{excluded_field_names.join("\n")}"
|
272
|
+
separator
|
273
|
+
add_code %q{
|
274
|
+
return doc;
|
275
|
+
}
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def key_for(field)
|
280
|
+
key = field.metadata[:pass_during_handshake]
|
281
|
+
if key.is_a?(String)
|
282
|
+
key
|
283
|
+
else
|
284
|
+
field.name.gsub(/([A-Z])/, '_\1').downcase
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
def value_expression_for(field)
|
289
|
+
case field.type
|
290
|
+
when 'StaticString'
|
291
|
+
"#{field.name}.toString()"
|
292
|
+
when 'int', 'unsigned int', 'bool'
|
293
|
+
field.name
|
294
|
+
when 'StringKeyTable<StaticString>'
|
295
|
+
"tableToJson(#{field.name})"
|
296
|
+
else
|
297
|
+
raise "Unsupported field type '#{field.type}' for field #{field.name}"
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
def parse_config_class_fields
|
302
|
+
config_h = File.dirname(__FILE__) + '/../Config.h'
|
303
|
+
parser = CxxHintedParser::Parser.load_file(config_h).parse
|
304
|
+
parser.structs['Config']
|
305
|
+
end
|
306
|
+
|
307
|
+
main
|