Skip to content

Commit

Permalink
Config file name from env
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonbaeten committed Dec 12, 2024
1 parent e5b583a commit 4e71a9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions frontend/src/PullTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Anchor, Avatar, Badge, Button, Card, Flex, Loader, Table, Title, Tooltip } from '@mantine/core';
import { Anchor, Avatar, Badge, Button, Card, Flex, Loader, Text, Table, Title, Tooltip, Box } from '@mantine/core';
import { Action, Pull, State, WorkflowStatus } from "./types";
import { RunButton } from './RunButton';
import { Dispatch } from 'preact/hooks';
Expand Down Expand Up @@ -63,9 +63,13 @@ export function PullTable({ state, dispatch }: PullTableProps) {
<Table.Tr key={pull.number}>
<Table.Td>
<PullRequest baseUrl={state.baseUrl} number={pull.number} />
<Anchor href={`${state.baseUrl}/pull/${pull.number}`} target="_blank">
{pull.title}
</Anchor>
<Box display="inline-block" maw="500">
<Anchor href={`${state.baseUrl}/pull/${pull.number}`} target="_blank">
<Text truncate="end">
{pull.title}
</Text>
</Anchor>
</Box>
</Table.Td>
<Table.Td>
{pull.assignees.map(assignee => (
Expand Down
6 changes: 5 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

use anyhow::Result;
use serde::Deserialize;

Expand Down Expand Up @@ -32,8 +34,10 @@ pub struct Config {

impl Config {
pub fn from_env() -> Result<&'static Config> {
let config_file = env::var("ETES_CONFIG_FILE").unwrap_or("config.toml".to_string());

let config: Config = config::Config::builder()
.add_source(config::File::with_name("config.toml"))
.add_source(config::File::with_name(&config_file))
.add_source(
config::Environment::with_prefix("etes")
.try_parsing(true)
Expand Down

0 comments on commit 4e71a9a

Please sign in to comment.