Can I create a config file for Parse Server? - json

I'm quite new to Parse Server, I wonder if I could create a config file for the Parse Server like the way I did in the Parse Dashboard. With the Parse Dashboard, I create a file named parse-server-config.json with this format:
{
"apps": [
{
"serverURL": "http://10.30.176.147:1337/parse",
"appId": "myFirstApp",
"masterKey": "myMasterKey",
"databaseURI": "mongodb://mongo/team"
}
]
}
And start the dashboard using parse-server --config parse-server-config.json, but I couldn;t do that with the Parse Server, I have to use this command parse-server --appId myFirstApp --masterKey myMasterKey --databaseURI mongodb://localhost:27017/team?readPreference=primary&appname=MongoDB%20Compass&ssl=false --mountGraphQL --mountPlayground to start the Parse server.

Yes. You need to use the following command:
parse-server path/to/config.json
Your config.json should look like this:
{
"appId": "APPLICATION_ID",
"masterKey": "MASTER_KEY",
"databaseURI": "mongodb://localhost/test"
}
You can see all configuration options in the following link:
http://parseplatform.org/parse-server/api/master/ParseServerOptions.html

Related

How to pass a list as an environment variable to an AWS Lambda function from a JSON config file?

I have a JSON file that is going to contain a number of different lists per client that I am deploying for. These lists are going to serve as container overrides for an ECS task that my Lambda function will be invoking. The JSON config file would look something like this:
{
"clientName": {
"environment": [
{
"name": "name1",
"value": "value1"
}
]
}
}
And my serverless.yml would look something like this:
environment:
CONTAINER_ENVIRONMENT: ${file(serverlessConfig.json):${env:CLIENT_NAME}.environment}
Which results in the following error:
Could not resolve "CONTAINER_ENVIRONMENT" environment variable: Unsupported environment variable format:
[
{
"name": "name1",
"value": "value1"
}
]
I've tried using CloudFormation intrinsic functions such as Fn::Join and Fn::ToJsonString. These both threw an error when trying to run locally using sls invoke local (the errors were the same as the above). After some digging it seems that these functions aren't compatible with the serverless environment property.
The only thing that has worked so far is storing the list as a string in a .env file, but that's not really ideal since these configs could take a number of different environment objects.
Is there any way to get this to work with the setup that I have going?

Vuejs: incorrect value on imported json file [Vue: 2.6.12]

I am using vuejs2 [version 2.6.12]. Trying to import a local JSON file.
JSON File content: {"name":"John", "age":30}
import json from '../static/data.json'
I am building the project by "npm run build" from CLI.
I am changing the JSON file content now:
New JSON File content: {"name":"Doe", "age":30}
Now I am Going to the "dist" folder and opening the index.html file. I am using the "name" on my template and seeing the "name" to be "John"
My Component data:
export default{
name: 'App',
data () {
return {
name: json.name,
},
mounted () {
//incorrect data. i have changed the name to "Doe", but still it is showing "John"
console.log(this.name) //logging John
}
}
When you create the build, imported json file also will mix with javascript.
If you change the name in json file after building the project, you won't get new value.
Try this instead,
Change the name in json and create the build.

Merge two configuration files during build time in angular 8

I’m working on an Angular 8.
We have a config file that contains the configuration and we have the app-specific config file. i.e. app.setting.json.
Each project will have its app.config.json file.
config.json look like
{
"settings": {
"xyz": false
},
"url": {}
}
app.setting.json
{
"settings": {
"xyz": true
}
}
We have implemented a service i.e. readConfigService that reads config.json file and returns its content to the app.
currently what I'm doing here is, in readConfigService, reading both the .json files using HTTP request and merging it in a single object and returning the same to the app.
Instead of merging it at runtime, finding a better approach to do the same during build time. i.e. ( ng build app name).
so after building the project, config.json should look like
{
"settings": {
"xyz": true
},
"url": {}
}
is there any way to merge the two .json files during build time?

Serilog configuration via appsettings.json for Application Insights

I am trying to use https://github.com/serilog/serilog-settings-configuration to read app settings and setup serilog for app insights: https://github.com/serilog/serilog-sinks-applicationinsights. The issue I am having is that I cannot set the last parameters for ApplicationInsightsEvents call, which is a function that takes LogEvent and returns ITelemetry. How can this be set via appsettings.json?
Basically, I want to replace the followoing line:
log.WriteTo.ApplicationInsightsEvents(instrumentationKey, level, CultureInfo.CurrentCulture, TelemetryConverter.ConvertLogEventsToEnerGovTelemetry);
with a line inside appsettings.json
Thanks.
Add a sink configuration to appsettings.json
{
"Name": "ApplicationInsights",
"Args": {
"instrumentationKey": "<instrumentationKey>",
"telemetryConverter": "Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights",
"outputTemplate": "[{Component}|{MachineName}|{ThreadId}] {Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] <{SourceContext}> {Message:lj}{NewLine}{Exception}"
}
}
And
"Serilog.Sinks.ApplicationInsights"
to "Serilog:Using" array
Answered on GitHub: https://github.com/serilog/serilog-settings-configuration/issues/165. Just need to write an assembly and embed the final code there.

Grunt - read json object from file

I want to use grunt-hash plugin for renaming my js files.
This plugin create a new file containing map of renamed files:
hash: {
options: {
mapping: 'examples/assets.json', //mapping file so your server can serve the right files
Now I need to fix links to this files by replacing all usages (rename 'index.js' to 'index-{hash}.js') so I want to use grunt-text-replace plugin.
According to documentation I need to cofigure replacements:
replace: {
example: {
replacements: [{
from: 'Red', // string replacement
to: 'Blue'
}]
}
}
How could I read json mapping file to get {hash} values for each file and provide them to replace task?
grunt.file.readJSON('your-file.json')
is probably what you are looking for.
I've set up a little test. I have a simple JSON file 'mapping.json', which contains the following JSON object:
{
"mapping": [
{"file": "foo.txt"},
{"file": "bar.txt"}
]
}
In my Gruntfile.js I've written the following simple test task, which reads the first object in the 'mapping'-array:
grunt.registerTask('doStuff', 'do some stuff.', function() {
mapping = grunt.file.readJSON('mapping.json');
grunt.log.write(mapping.mapping[0]["file"]).ok();
});
When invoking the Grunt task, the console output will be as follows:
$ grunt doStuff
Running "doStuff" task
foo.txtOK
Done, without errors.
I hope this helps! :)