mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Use env var for transcoder url (#426)
This commit is contained in:
parent
c46385d467
commit
c2a519923a
@ -16,6 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AspNetCore.Proxy;
|
using AspNetCore.Proxy;
|
||||||
using AspNetCore.Proxy.Options;
|
using AspNetCore.Proxy.Options;
|
||||||
@ -28,6 +29,12 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
|
|
||||||
namespace Kyoo.Core.Api;
|
namespace Kyoo.Core.Api;
|
||||||
|
|
||||||
|
public static class Transcoder
|
||||||
|
{
|
||||||
|
public static string TranscoderUrl =
|
||||||
|
Environment.GetEnvironmentVariable("TRANSCODER_URL") ?? "http://transcoder:7666";
|
||||||
|
}
|
||||||
|
|
||||||
public abstract class TranscoderApi<T>(IRepository<T> repository, IThumbnailsManager thumbs)
|
public abstract class TranscoderApi<T>(IRepository<T> repository, IThumbnailsManager thumbs)
|
||||||
: CrudThumbsApi<T>(repository, thumbs)
|
: CrudThumbsApi<T>(repository, thumbs)
|
||||||
where T : class, IResource, IThumbnails, IQuery
|
where T : class, IResource, IThumbnails, IQuery
|
||||||
@ -53,7 +60,7 @@ public abstract class TranscoderApi<T>(IRepository<T> repository, IThumbnailsMan
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.Build();
|
.Build();
|
||||||
return this.HttpProxyAsync($"http://transcoder:7666{route}", proxyOptions);
|
return this.HttpProxyAsync($"{Transcoder.TranscoderUrl}{route}", proxyOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Task<(string path, string route)> GetPath(Identifier identifier);
|
protected abstract Task<(string path, string route)> GetPath(Identifier identifier);
|
||||||
|
@ -58,7 +58,7 @@ public class ProxyApi(ILibraryManager library) : Controller
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.Build();
|
.Build();
|
||||||
return this.HttpProxyAsync($"http://transcoder:7666/{route}", proxyOptions);
|
return this.HttpProxyAsync($"{Transcoder.TranscoderUrl}{route}", proxyOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -16,6 +16,8 @@ services:
|
|||||||
back:
|
back:
|
||||||
build: ./back
|
build: ./back
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
environment:
|
||||||
|
- TRANSCODER_URL=${TRANSCODER_URL:-http://transcoder:7666}
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -26,6 +26,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
environment:
|
||||||
|
- TRANSCODER_URL=${TRANSCODER_URL:-http://transcoder:7666}
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -17,6 +17,8 @@ services:
|
|||||||
image: zoriya/kyoo_back:latest
|
image: zoriya/kyoo_back:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
cpus: 1.5
|
cpus: 1.5
|
||||||
|
environment:
|
||||||
|
- TRANSCODER_URL=${TRANSCODER_URL:-http://transcoder:7666}
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user