How do I setup a rule to match on HTTP host when using Firebase hosting rewrites? - firebase-hosting

I have a Firebase project in which I have configured static hosting. I have two domains test1.domain.com and test2.domain.com, both configured within the control panel. Each has an A record pointing to the given server IP addresses shown during configuration.
Without any configuration, browsing both domains individually serves up the index.html of the public directory.
.
├── .firebaserc
├── firebase.json
└── public
├── 404.html
├── index.html
├── test1.domain.com
│   └── index.html
└── test2.domain.com
└── index.html
Below is example pseudocode for what I'm tying to achieve, effectively splitting the single hosting space into two. In words, any URI resource at test1.domain.com will serve the corresponding content within that sub-directory. Same applies to test2.domain.com
"rewrites": [
{
"source": "https://test1.domain.com/**",
"destination": "/test1.domain.com/**"
},
{
"source": "https://test2.domain.com/**",
"destination": "/test2.domain.com/**"
}
]
Is this possible, and if so how?

Related

Sharing logic between different virtual environmets

I currently have two working python virtual environments and would like to share some code between them so that I don't need to have that logic on both environments. Do I need to build a custom package to make this possible?
I have tried creating a shared folder on both projects which is a symlink to a common folder and is working fine, however this seems to break the essence of virtual environments doesn't it?
This is my directory structure:
├── common
├── env1
│   ├── env1-venv
│   └── src
└── env2
├── env2-venv
└── src
├── shared
├── ...

Setup with Swagger UI and Swagger Editor using yaml split across mutliple files

I would like to use swagger for our project, which is rather big. Documenting the whole REST-API in one single yaml file would be too much, so I would like to split it into several yaml files.
First I tried to use Swagger UI simply by downloading it an opening its index.html. That works until the point that I split the yaml into multiple files, as I got CORS errors then. To circumvent them, I simply deployed the Swagger-UI Folder, with my projects yaml files inside it as artifact to my tomcat.
The folder structure of the artifact looked like this:
swagger_ui
├── index.html
└── api
├── root.yaml
├── paths
│ ├── path1.yaml
│ ├── path2.yaml
│ └── ...
└── schemas
├── schema1.yaml
├── schema2.yaml
└── ...
Now all CORS errors were gone, as my references are now all within the same origin (eg. "http://localhost:8080/swagger_ui")
So far, so good.
Now I wanted to have a simple way of editing the files using Swagger Editor.
In Swagger Editor, I click on File --> Import URL and import my root.yaml file. Now I get a bunch of errors saying the URLs to "paths" and "schemas" can not be resolved... Which makes sense, as I only imported root.yaml and the path and schema files are stored on a completely different server.
So my current approach is to deploy Swagger Editor alongside Swagger UI in my tomcat.
The current folder structure looks like this:
swagger_ui
└── index.html
swagger_editor
└── index.html
api
├── root.yaml
├── paths
│ ├── path1.yaml
│ ├── path2.yaml
│ └── ...
└── schemas
├── schema1.yaml
├── schema2.yaml
└── ...
I thougt I can use eg. "$ref: '../api/paths/path1.yaml'" to reference the the path1.yaml file from BOTH Swagger UI and Swagger Editor, but I get the Error:
Could not resolve reference: Tried to resolve a relative URL, without having a basePath. path: '../api/paths/path1.yaml' basePath: 'undefined'".
Aside from this error... Using ".." to go up one directory does not seem right in itself...
So the question is:
Which is the right way to set up a Swagger API Definition that has the following properties:
It is spread over multiple yaml files
It can be edited in Swagger Editor
It can also simply be visualized in Swagger UI
If my current approach is totaly wrong and there is a completely different approach, please tell me. It is no requirement to use tomcat or anything else I stated above. I just wanted to know if my approach makes any sense at all.

How to change the sitename setting with Pelican?

I'm a new learner of Pelican.
I have created my personal website including basic settings and some pages by using Pelican, and the following hierarchy has already existed on the local PC:
myblog/
├── author
├── content # Content file (Push on GitHub)
│ └── (pages)
├── output
├── theme
├── develop_server.sh
├── fabfile.py
├── Makefile
├── pelicanconf.py # Main settings file
└── publishconf.py
Unfortunately, I set the wrong sitename from the beginning when I install Pelican. Right now I'm struggling to change the incorrect sitename from "test" to "XXX's blog". I can rewrite sitename directly in the document called pelicanconf.py. But after that, there's no way to push it on GitHub. So the appearance of my website remains stable.
The only thing I could do is to update the page content again and again, but not the sitename. Because only the content folder is synchronized with my remote GitHub repository.
Is there anyway to change the sitename setting?

using blueprints on Hierarchical APIs in Sails

I've got a models folder (and corresponding controllers folder) that looks like this:
.
├── Pets
| ├── User.js
│   └── Pet.js
└── UserManager
   ├── User.js
   ├── Group.js
   └── Organization.js
and would like to use REST blueprints of the type
POST to foosite.com/userManager/user
or at least
POST to foosite.com/user
Is there an easy way to do this?
Corresponding shortcut routes and action routes would also be nice.
Thanks!
You can use controllers in subfolders and specify their corresponding model.
Currently models do not work in subfolders.
Check out this answers
Create subfolders in Sails.js /api/controllers
Is it possible to group controllers in sails using subfolders?

When I compile PlayN core code to HTML in Eclipse, where do I find the JS/HTML files?

I'd like to take the files and upload them to a publicly hosted site.
This is the document tree I find when I follow the path listed in the Eclipse output:
/home/.../playndev/html/target/playndev-html-0.0.1-SNAPSHOT/playndev
├── clear.cache.gif
├── F23CD74BBFAF29D08D2B82AA57A90407.cache.html
├── gwt-voices.swf
├── hosted.html
├── images
│   └── bg.png
└── playndev.nocache.js
I would expect to be able to move the root playndev directory to another public server folder and run my script independently, but when I move them for instance to /var/www/playndev on my machine, neither the F23CD...cache.html file or hosted.html loads.
Am I misunderstanding the document layout or something more fundamental?
There should not be any problem in changing the location of GWT generated files as long as the Host page has proper location for nocache.js file which you can verify in the script tag of your Host page. Refer to this link for more info
GWT only generates a script (set of scripts and resources), you're responsible for providing an HTML host page that loads the generated playndev/playndev.nocache.js script.
You're supposed to put that HTML page in your project's src/main/webapp and it will be copied by Maven into the target/playndev-html-0.0.1-SNAPSHOT folder. You can then copy the whole content of that folder to /var/www (or a subfolder)
Thank you Ganesh and Thomas for your helpful responses. Applying their advice, I just added a file playndev.html with the following code (this is similar to what is auto-generated by GWT) to my site directory:
<!DOCTYPE html>
<html>
<head>
<title>PlaynDev</title>
</head>
<body bgcolor="white">
<h2>PlaynDev HTML</h2>
<script src="playndev.nocache.js"></script>
</body>
</html>
The updated directory tree:
/var/www/playndev/
├── clear.cache.gif
├── F23CD74BBFAF29D08D2B82AA57A90407.cache.html
├── gwt-voices.swf
├── hosted.html
├── images
│   └── bg.png
├── playdev.html <--- added host page
└── playndev.nocache.js
On my machine, I access the page at http://localhost/playndev/playndev.html