SampleConf.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*
  3. * Copyright 2014 Baidu, Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * Http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  11. * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  12. * specific language governing permissions and limitations under the License.
  13. */
  14. use BaiduBce\BceClientConfigOptions;
  15. error_reporting(-1);
  16. date_default_timezone_set('UTC');
  17. define('__BOS_CLIENT_ROOT', dirname(__DIR__));
  18. $BOS_TEST_CONFIG =
  19. array(
  20. 'credentials' => array(
  21. 'accessKeyId' => 'your ak',
  22. 'secretAccessKey' => 'your sk',
  23. 'sessionToken' => 'your session token'
  24. ),
  25. 'endpoint' => 'host',
  26. 'stsEndpoint' => 'sts host',
  27. );
  28. $CUSTOM_BOS_TEST_CONFIG =
  29. array(
  30. 'credentials' => array(
  31. 'accessKeyId' => 'your ak',
  32. 'secretAccessKey' => 'your sk',
  33. 'sessionToken' => 'your session token'
  34. ),
  35. 'endpoint' => 'customized host',
  36. 'custom' => true,
  37. 'stsEndpoint' => 'sts host',
  38. );
  39. // this in your YourConf.php
  40. $SMS_TEST_CONFIG =
  41. array(
  42. BceClientConfigOptions::PROTOCOL => 'http',
  43. BceClientConfigOptions::REGION => 'bj',
  44. 'credentials' => array(
  45. 'ak' => 'your ak',
  46. 'sk' => 'your sk'
  47. ),
  48. 'endpoint' => 'smsv3.bj.baidubce.com',
  49. );
  50. $STDERR = fopen('php://stderr', 'w+');
  51. $__handler = new \Monolog\Handler\StreamHandler($STDERR, \Monolog\Logger::DEBUG);
  52. $__handler->setFormatter(
  53. new \Monolog\Formatter\LineFormatter(null, null, false, true)
  54. );
  55. \BaiduBce\Log\LogFactory::setInstance(
  56. new \BaiduBce\Log\MonoLogFactory(array($__handler))
  57. );
  58. \BaiduBce\Log\LogFactory::setLogLevel(\Psr\Log\LogLevel::DEBUG);