updated plugins dir location
This commit is contained in:
		
							parent
							
								
									23414b6d8b
								
							
						
					
					
						commit
						e028344b97
					
				| @ -8,12 +8,14 @@ RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python | ||||
| RUN python3 -m ensurepip | ||||
| RUN pip3 install --no-cache --upgrade pip setuptools | ||||
| 
 | ||||
| ADD . /var/www/plugin-server | ||||
| ADD ./plugin-server.py /var/www/plugin-server/plugin-server.py | ||||
| ADD ./plugin-loader.js /var/www/plugin-server/plugin-loader.js | ||||
| ADD ./requirements.txt /var/www/plugin-server/requirements.txt | ||||
| 
 | ||||
| WORKDIR /var/www/plugin-server/ | ||||
| 
 | ||||
| RUN pip install -r requirements.txt | ||||
| 
 | ||||
| RUN ln -s /var/www/plugins ./plugins | ||||
| RUN ln -s /var/www/plugins/ ./ | ||||
| 
 | ||||
| CMD sh start.sh | ||||
| CMD /usr/bin/redis-server & python plugin-server.py | ||||
| @ -36,7 +36,7 @@ Then you can run [flask server](plugin-server.py) on a server. | ||||
| 
 | ||||
| ## Example | ||||
| 
 | ||||
| Let's say you are hosting plugins on lexonomyplugins.example.com and that there is a plugin (a folder) called myplugin in `CWD` of the server python process. You need to set: | ||||
| Let's say you are hosting plugins on lexonomyplugins.example.com and that there is a plugin (a folder) called myplugin in `CWD/plugins/` of the server python process. You need to set: | ||||
| 
 | ||||
| * `plugin: "//lexonomyplugins.example.com/myplugin"` in javascript loader, | ||||
| * `URL = "//lexonomyplugins.example.com/myplugin"` in python server, | ||||
|  | ||||
| @ -7,6 +7,6 @@ services: | ||||
|       dockerfile: Dockerfile | ||||
|     restart: always | ||||
|     volumes: | ||||
|       - /home/ozbolt/plugins:/var/www/plugins | ||||
|       - ./plugins:/var/www/plugins | ||||
|     ports: | ||||
|       - "8085:5000" | ||||
|  | ||||
| @ -25,6 +25,7 @@ redis = redis.Redis(host='localhost', port=6379, db=0) | ||||
| 
 | ||||
| URL = "https://plugins.lexonomy.cjvt.si" | ||||
| REPLACE_STRING = "$LOCATION$" | ||||
| PLUGINS_DIR = os.environ.get("PLUGINS_DIR_PATH", "plugins") | ||||
| 
 | ||||
| 
 | ||||
| def check_cache(full_path): | ||||
| @ -49,6 +50,7 @@ def generate_etag(N=12): | ||||
| 
 | ||||
| def return_file(path, plugin=None): | ||||
|     full_path = path if plugin is None else"{}/{}".format(plugin, path) | ||||
|     full_path = f"{PLUGINS_DIR}/{full_path}" | ||||
| 
 | ||||
|     if not os.path.isfile(full_path): | ||||
|         return "File not found", 404 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user