我有一个 docker 文件,应该使用 wait_for_it.sh 等待数据库并运行 minio 服务器。
我从 run/secrets 读取机密并创建 MINIO_SECRET_KEY 和 MINIO_ACCESS_KEY。
MINIO 服务器已启动,但我无法与 minio 客户端(js 客户端)连接,并且出现以下错误:
The access key ID you provided does not exist in our records
Run Code Online (Sandbox Code Playgroud)
我的客户代码:
const accessKey = fileService.readFile(configService.get('minio').access_key_file);
const secretKey = fileService.readFile(configService.get('minio').secret_key_file);
this.minioClient = new Minio.Client({
endPoint: configService.get('minio').host,
port: configService.get('minio').port,
useSSL: configService.get('minio').useSSL,
accessKey: accessKey.trim(),
secretKey: secretKey.trim()
});
Run Code Online (Sandbox Code Playgroud)
我的泊坞窗入口点(bash):
docker_secrets_env() {
ACCESS_KEY_FILE="$MINIO_ACCESS_KEY_FILE"
SECRET_KEY_FILE="$MINIO_SECRET_KEY_FILE"
if [ -f "$ACCESS_KEY_FILE" ] && [ -f "$SECRET_KEY_FILE" ]; then
if [ -f "$ACCESS_KEY_FILE" ]; then
MINIO_ACCESS_KEY="$(cat "$ACCESS_KEY_FILE")"
export MINIO_ACCESS_KEY …Run Code Online (Sandbox Code Playgroud) 我有 react-app 的示例安装,我得到了以下内容
Error: Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'
Run Code Online (Sandbox Code Playgroud)
跑完后
npm run lint -> eslint .
Run Code Online (Sandbox Code Playgroud)
我在这个项目中不使用打字稿。我尝试从头开始安装它并再次安装它。还尝试从 vscode 插件中删除 tslint
我有一个用 jest 加载的配置文件,我正在尝试使用 mock-fs 库创建一个用于集成测试的文件夹
我收到这个错误:
no such file or directory, lstat : 'path to one of another folder in the current directory '
Run Code Online (Sandbox Code Playgroud)
我也得到了这个:
TypeError: mock_fs_1.default is not a function
Run Code Online (Sandbox Code Playgroud)
在我加载到玩笑的配置文件中,我还引入了以下库:
import * as getPort from 'get-port';
import { mockServerClient } from 'mockserver-client';
import * as mockServerNode from 'mockserver-node';
import mockfs from 'mock-fs';
mockfs({
'path/to/fake/dir': {
'some-file.txt': 'file content here',
},
});
Run Code Online (Sandbox Code Playgroud) 我有一个来自 Nestjs/common 的 httpService
我正在使用如下内容:
const response = await this.httpService.post(`${this.api}/${action}`, data).toPromise();
Run Code Online (Sandbox Code Playgroud)
在我的笑话规范文件(单元测试)中。我想嘲笑这项服务
httpServiceMock = {
post: jest.fn()
};
it('should start', async () => {
const serviceResult = await service.start(data);
});
Run Code Online (Sandbox Code Playgroud)
我遇到了这个错误:
TypeError: this.httpService.post(...).toPromise is not a function
Run Code Online (Sandbox Code Playgroud)
我还尝试添加一个承诺结果,例如:
const promise = Promise.resolve('result');
httpServiceMock.post.mockResolvedValue(promise);
Run Code Online (Sandbox Code Playgroud)
也尝试过:
it('should start', async () => {
const mockObservable = Promise.resolve({
toPromise: () => {
console.log('toPromise called');
}
})
httpServiceMock.post.mockImplementation(() => mockObservable);
const serviceResult = await service.start();
});
Run Code Online (Sandbox Code Playgroud)
我的问题是如何模拟承诺并返回响应或异常
我对打字稿做出了反应。
我正在尝试向我的项目添加一些 eslint,但在 yarn lint 期间出现此错误
(eslint src/** --ext .ts,.tsx")
我也在 css 上遇到了一些错误
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/logo.svg.
The extension for the file (.svg) is non-standard. You should add "parserOptions.extraFileExtensions" to your config
Run Code Online (Sandbox Code Playgroud)
.css 也一样
我的 eslint 基于这篇文章 https://gist.github.com/1natsu172/a65a4b45faed2bd3fa74b24163e4256e
我正在尝试在打字稿(node.js)中使用类转换器: https: //github.com/typestack/class-transformer
我想仅使用 1 个模型、1 个 Dto 来平展 JSON,并将其发送到数据库
如果我有以下 json :
{
"data":{"test":"123"}
"name":"x"
}
Run Code Online (Sandbox Code Playgroud)
数据库服务应该接收以下对象:
{
"test":"123",
"name":"x"
}
Run Code Online (Sandbox Code Playgroud)
这是我试图定义的,但它不起作用:
@Expose()
export class Dto{
name:string,
@Expose({name: "data.test"})
test: string
}
Run Code Online (Sandbox Code Playgroud)
测试场的结果未定义,我该如何实现?我不想创建“中介”模型
是否存在禁用xdebug的性能问题?我的问题,如果我可以禁用它并将其留在php.in或我应该删除所有部分
; XDEBUG Extension
[xdebug]
zend_extension ="C:/wamp64/bin/php/php5.6.16/zend_ext/php_xdebug-2.4.0rc2-5.6-vc11-x86_64.dll"
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="C:/wamp64/tmp"
xdebug.show_local_vars=0
Run Code Online (Sandbox Code Playgroud) 我有一个简单的 PHP 脚本来检查 PDO SQL 连接,然后该脚本会执行一些操作。
问题是,当我从 Windows 计划甚至从批处理文件或直接从计划程序运行它作为计划任务运行时,php.exe -f "script file"
会出现命令提示符窗口,这很烦人。
从调度程序运行脚本时是否可以禁用 cmd 弹出窗口?
您好,尝试将以下字符串替换为长字符串:
@x@
Run Code Online (Sandbox Code Playgroud)
使用我从命令行获得的字符串:
read test
sed -i --backup 's/@x@/'${test}'/g' file.json README.md
Run Code Online (Sandbox Code Playgroud)
但它仅适用于1 个单词,如果单词之间有空格则不起作用。即使在引号之间
sed: 1: "s/@x@/string test string: unterminated substitute in regular expression
Run Code Online (Sandbox Code Playgroud) 我总是看到将字节转换为 MB 或 GB 的解决方案
是否有将 MB 转换为字节的正确解决方案
现在,我使用如下:
MB * Math.pow(1024, 2);
Run Code Online (Sandbox Code Playgroud)
但如果我想转换 10GB,那么我设置 10 GB = 10000 MB,结果以字节为单位是不同的
谢谢
嗨,我正在尝试在CSS中创建动画
应该每秒闪烁一次,然后重复3次。最后,边框在默认情况下应显示为常规
我尝试了以下方法,但最后边界消失了。最后,我需要边框颜色仍然与动画颜色相同
.alerts-border {
border: 1px solid;
animation: blink 1s;
animation-iteration-count: 3;
}
@keyframes blink { 50% { border-color: #ff0000; } }
Run Code Online (Sandbox Code Playgroud) 例如,我从 Kubernetes 官方 javascript 客户端运行以下函数:
.listNamespacedPod("default", null, "false", "smth=test", null, null, null, null, null, null)
Run Code Online (Sandbox Code Playgroud)
或任何其他功能。
有一个参数称为标签选择器。
现在我想使用以下标签选择器查找 Pod(如 HTTP 请求中):
smth=test
Run Code Online (Sandbox Code Playgroud)
但我无法smth=test作为字符串发送。
如何通过标签选择器进行过滤?
这是我来自 YAML 的元数据:
metadata:
name: label-demo
labels:
smth: test
app: nginx
Run Code Online (Sandbox Code Playgroud)
我可以通过以下方式运行kubectl:
kubectl -n="namespace" get deployments -l=smth=test
Run Code Online (Sandbox Code Playgroud)
所以它只会返回匹配的标签。