next.js alias for sibling directory of src - path

I have this folder structre:
I want to create alias from src to ethereum:
this work fine for "src" directory. in jsconfig.json:
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"#/*": ["/*"]
}
}
}
since ethereum is sibling with src, first I tried this:
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"#/ethereum": ["../ethereum"],
"#/*": ["/*"]
}
}
}
This is saying if you see #/ethereum go outside, find ethereum. this did not work. Then I tried this:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"#/ethereum": ["./ethereum"],
"#/*": ["./src/*"]
}
}
}
that says, if you see "#/ethereum, since base dir is ".", just go to "./ethereum". This did not work either. I am currently moving without "ethereum" alias, but it would be nice to have a consistent project.

Try this maybe:
"baseUrl": ".",
"paths": {
"#/ethereum/*": ["./ethereum/*"],
"#/*": ["./src/*"]
}
}
}
You seem to miss the *. Using "baseUrl": "." is indeed correct.

Related

Redirect only if a URL query matches

How to config apple-app-site-association to open/redirect only link with specific url query?
For example I would like to open only links like this https://www.example.com/?modal=CreatePassword
This is my current config an it opens all links even without the url query (modal=CreatePassword)
"applinks": {
"details": [
{
"appIDs": [
"com.app"
],
"components": [
{
"?": {
"modal": "CreatePassword"
}
}
]
}
]
}
I found that iOS keeps/downloads old file even after reinstallation of the app(delete -> install). This video was very helpful: https://youtu.be/xxyEq_ySoO4
I downloaded sysdiagnose file from my iPhone and checked swcutil_show.txt, and found that it keeps old version of the apple-app-site-association file.
The correct config for me:
{
"applinks": {
"details": [
{
"appIDs": [ "com.app" ],
"components": [{
"?":{"modal":"CreatePassword"},
"/":"/"
}
]
}
]
}
}

Resource files are not added to the application on electron

I am trying to add an executable file to an application that I am making using vuejs and electron so that I can run it on the user's computer from the application.
But after building and running on the user's computer, this folder with the program does not appear in the resources folder of my program.
My vue.config.js
pluginOptions: {
electronBuilder: {
extraResources: [
{
"from": "extraResources/SumatraPDF-3.4.6-64.exe",
"to": "extraResources/SumatraPDF-3.4.6-64.exe"
}
],
win: {
target: "portable"
}
}
}
This solved my problem
module.exports = defineConfig({
transpileDependencies: true,
pluginOptions: {
electronBuilder: {
builderOptions: {
extraResources: [
{
"from": "extraResources/SumatraPDF-3.4.6-64.exe",
"to": "extraResources/SumatraPDF-3.4.6-64.exe"
}
],
win: {
target: "portable"
}
}
}
}
});

Serilog not creating log file on production server

I've created a C# .net5.0 console application and during testing Serilog has been working without incident, logging to Console and File (same folder; path="log.txt"). However, when I run on the application on our server, neither Console nor File logging sinks are working! I assume now that the issue is not the sinks themselves but Serilog not actually working.
I've tried enabling the self log:
Serilog.Debugging.SelfLog.Enable(msg =>
Console.WriteLine(msg)
);
but even running in the debugger in my dev environment, the Console.WriteLine(msg) line is never called!
My appsettings.json is as follows:
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"System": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "log.txt",
"rollingInterval": "Infinite",
"outputTemplate": "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"shared": false
}
}
],
"Enrich": [ "FromLogContext" ]
},
"Database": {
"Server": "(local)",
"Database": "ActivbaseLive"
},
"Email": {
"SmtpHost": "localhost",
"SmtpPort": 25,
"SmtpSecurityOption": "None",
"SmtpUsername": null,
"SmtpPassword": null,
"SmtpSender": "\"Activbase Learning Platform\" <noreply#activbase.net>"
}
}
I've tried absolute paths (using double backslashes in appsettings.json).
I've tried pre-creating the log file (e.g. log.txt and log200428.txt) and setting permissions to Everyone Full Control but neither of these changes fix the problem and they don't explain why the Console sink doesn't write either.
Here is how Serilog is being configured during start-up which is where I suspect the problem is (even through it works in dev environment):
return Host.CreateDefaultBuilder()
.ConfigureLogging(logging =>
{
logging.ClearProviders();
})
.UseSerilog((hostContext, loggerConfiguration) =>
{
loggerConfiguration.ReadFrom.Configuration(hostContext.Configuration);
})
.ConfigureAppConfiguration((hostContext, builder) =>
{
builder.AddEnvironmentVariables();
})
.ConfigureServices(services =>
{
services.AddHostedService<Worker>();
...
});
}
Any ideas why Serilog isn't working in production?
The Path you provide should be absolute.
Some thing like this:
"path": "E:/wwwroot/QA/BackgroundWorkerService/Logs/logFile_.log"
Even I had the same issue, the above fix worked fine for me...
For my api application running in IIS: I had to assign the following permissions to the log folder for the IIS_IUSRS. I didn't need an absolute path!

String interpolation in jenkins pipeline for evaluating a string received as argument

I'm a newbie to jenkins/groovy and I'm lost at string interpolation.
We're trying to read a list of steps from a configuration file (stored in json format) and execute some actions bases on it in jenkins pipeline script.
Configuration file:
{
"actions": [ {
"operation": "create",
"args": [
{ "path": "${env.SVNRoot}\\trunk\\ABC" },
{ "path": "${env.SVNRoot}\\trunk\\XYZ" }
]
}, {
"operation": "delete",
"args": [
{ "path": "${env.SVNRoot}\\trunk\\ABC" },
{ "path": "${env.SVNRoot}\\trunk\\XYZ" }
]
}
] }
Jenkins Pipeline code:
node('master') {
echo "${env.SVNRoot}" //String interpolation works here, giving the right value
stage('ReadConfig'){
cfg = readJSON file: 'Cfg.json'
}
stage('ExecuteConfigActions'){
cfg.fileActions.each() {
switch(it.operation) {
case 'create':
it.args.each() {
echo it.path //String interpolation doesnt work here
break;
default:
break;
}
}
}
}
}
How can I get string interpolation to work in such a scenario? Basically I want the environment variable value to be substituted in its placeholder and the path hence derived.
I've tried single, double, escaped quotes to no avail.
The closest I can suggest is formulating a sprintf statement stored in the Configuration file and evaluated in your pipeline. Use at your own risk of someone being able to use the configuration file and substitute whatever they want. If you need to specify which environment variable in the config file and evaluate an interpolation still, check out this answer: evaluating a groovy string expression at runtime
Configuration file:
{
"actions": [ {
"operation": "create",
"args": [
{ "path": "%s\\trunk\\ABC" },
{ "path": "%s\\trunk\\XYZ" }
]
}, {
"operation": "delete",
"args": [
{ "path": "%s\\trunk\\ABC" },
{ "path": "%s\\trunk\\XYZ" }
]
}
] }
Pipeline code:
node('master') {
echo "${env.SVNRoot}" //String interpolation works here, giving the right value
stage('ReadConfig'){
cfg = readJSON file: 'Cfg.json'
}
stage('ExecuteConfigActions'){
cfg.fileActions.each() {
switch(it.operation) {
case 'create':
it.args.each() {
echo sprintf(it.path,env.SVNRoot)
}
break;
default:
break;
}
}
}
}

How to rewrite URL to another folder using Firebase?

I would like to rewrite URL for example myweb.com/index and show content of myweb.com/production/index.com and I want to do that for all pages, that they would be showing content of the same file but in the directory production.
I mean, that Firebase.json would look something like this (of course this doesn't work):
{
"hosting": {
"public": "public",
"cleanUrls": true,
"rewrites": [ {
"source": "**",
"destination": "/production/**"
}
]
}
}

Resources