Skip to content

Commit 1b492e4

Browse files
committed
server use json or env, update compose, add example env
1 parent a25c2da commit 1b492e4

File tree

10 files changed

+102
-32
lines changed

10 files changed

+102
-32
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@
3030
**/values.dev.yaml
3131
LICENSE
3232
README.md
33+
34+
35+
docker/
36+
design/
37+
ImmichFrame/
38+
ImmichFrame.Android/
39+
ImmichFrame.Desktop/
40+
Makefile
41+
PrivacyPolicy.md

ImmichFrame.WebApi/Models/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public Settings()
2525
Albums = env["Albums"]?.ToString()?.Split(',').Select(x => new Guid(x)).ToList() ?? new();
2626
ExcludedAlbums = env["ExcludedAlbums"]?.ToString()?.Split(',').Select(x => new Guid(x)).ToList() ?? new();
2727
People = env["People"]?.ToString()?.Split(',').Select(x => new Guid(x)).ToList() ?? new();
28-
RefreshAlbumPeopleInterval = Convert.ToInt32(env["RefreshAlbumPeopleInterval"]);
28+
RefreshAlbumPeopleInterval = Convert.ToInt32(env["RefreshAlbumPeopleInterval"] ?? 12);
2929
ImmichFrameAlbumName = env["ImmichFrameAlbumName"]?.ToString() ?? string.Empty;
3030
}
3131
catch (Exception ex)

ImmichFrame.WebApi/Program.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
1+
using ImmichFrame.Core.Exceptions;
12
using ImmichFrame.Core.Helpers;
23
using ImmichFrame.Core.Logic;
34
using ImmichFrame.WebApi.Models;
5+
using System.Text.Json;
46

57
var builder = WebApplication.CreateBuilder(args);
68

79
// Add services to the container.
810

9-
builder.Services.AddSingleton(srv =>
11+
12+
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config", "Settings.json");
13+
14+
Console.WriteLine(settingsPath);
15+
16+
Settings? settings = null;
17+
18+
if (File.Exists(settingsPath))
1019
{
11-
var settings = new Settings();
20+
var json = File.ReadAllText(settingsPath);
21+
JsonDocument doc;
22+
try
23+
{
24+
doc = JsonDocument.Parse(json);
25+
}
26+
catch (Exception ex)
27+
{
28+
throw new SettingsNotValidException($"Problem with parsing the settings: {ex.Message}", ex);
29+
}
30+
31+
settings = JsonSerializer.Deserialize<Settings>(doc);
32+
}
1233

34+
builder.Services.AddSingleton(srv =>
35+
{
1336
if (settings == null)
14-
throw new FileNotFoundException();
37+
settings = new Settings();
1538

1639
return new ImmichFrameLogic(settings);
1740
});

README.Docker.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

docker/docker-compose.dev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ services:
55
target: dev
66
ports:
77
- 8080:8080
8-
volumes:
9-
- ~/immichFrame_Config:/app/Config
8+
env_file:
9+
- .env
10+
# volumes:
1011
# - PATH/TO/CONFIG:/app/Config

docker/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ services:
44
container_name: immichframe
55
image: ghcr.io/immichframe/immichframe:main
66
restart: on-failure
7-
volumes:
8-
- PATH/TO/CONFIG:/app/Config
7+
# volumes:
8+
# - PATH/TO/CONFIG:/app/Config
99
ports:
1010
- "8080:8080"
11+
env_file:
12+
- .env
1113
environment:
1214
TZ: "Europe/Berlin"

docker/example.env

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ImmichServerUrl=URL
2+
ApiKey=KEY
3+
ImageStretch=Uniform
4+
Margin=0,0,0,0
5+
Interval=10
6+
TransitionDuration=2
7+
DownloadImages=false
8+
ShowMemories=false
9+
RenewImagesDuration=30
10+
Albums=ALBUM1,ALBUM2
11+
ExcludedAlbums=ALBUM3,ALBUM4
12+
People=PERSON1,PERSON2
13+
RefreshAlbumPeopleInterval=12
14+
ImmichFrameAlbumName=
15+
ShowClock=true
16+
ClockFontSize=36
17+
ClockFormat=HH:mm:ss
18+
ShowPhotoDate=true
19+
PhotoDateFontSize=24
20+
PhotoDateFormat=yyyy-MM-dd
21+
ShowImageDesc=true
22+
ImageDescFontSize=24
23+
ShowImageLocation=true
24+
ImageLocationFormat=City,State,Country
25+
ImageLocationFontSize=16
26+
FontColor=#FF5733
27+
WeatherApiKey=
28+
ShowWeatherDescription=true
29+
WeatherFontSize=24
30+
UnitSystem=imperial
31+
WeatherLatLong=
32+
Language=en
33+
UnattendedMode=false

immichFrame.Web/src/lib/components/home-page/home-page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
<ProgressBar
101101
autoplay
102102
hidden={false}
103+
location={ProgressBarLocation.Bottom}
103104
duration={45}
104105
bind:this={progressBar}
105106
bind:status={progressBarStatus}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// import { writable } from 'svelte/store';
2+
3+
function createConfigStore() {
4+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5+
const config: any = fetchConfig();
6+
7+
return {
8+
config
9+
};
10+
}
11+
12+
const fetchConfig = async () => {
13+
console.log('fetching');
14+
const res = await fetch('../../../ImmichFrame.WebApi/settings.json');
15+
let config;
16+
if (res.ok) {
17+
config = await res.json();
18+
console.log(config);
19+
} else {
20+
console.error('Failed to load config file');
21+
}
22+
};
23+
24+
export const configStore = createConfigStore();

0 commit comments

Comments
 (0)